Created endpoint for get,update,delete

This commit is contained in:
Piyush
2024-12-23 19:28:37 +05:30
parent d7e2e35746
commit db48cf9502
11 changed files with 279 additions and 19 deletions

View File

@@ -1,12 +1,17 @@
package net.gepafin.tendermanagement.service.impl;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import net.gepafin.tendermanagement.dao.NotificationDao;
import net.gepafin.tendermanagement.enums.NotificationEnum;
import net.gepafin.tendermanagement.model.request.NotificationReq;
import net.gepafin.tendermanagement.model.response.NotificationResponse;
import net.gepafin.tendermanagement.service.NotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
public class NotificationServiceImpl implements NotificationService {
@@ -15,12 +20,33 @@ public class NotificationServiceImpl implements NotificationService {
private NotificationDao notificationDao;
@Override
public NotificationReq sendNotification(Long userId, NotificationReq notificationReq) {
public NotificationResponse sendNotification(Long userId, NotificationReq notificationReq) {
log.info("Sending notification to user {} with content: {}", userId, notificationReq.getMessage());
notificationReq.setUserId(userId);
notificationReq = notificationDao.sendNotification(notificationReq);
return notificationReq;
NotificationResponse notificationResponse = notificationDao.sendNotification(notificationReq);
return notificationResponse;
}
@Override
public NotificationResponse getNotificationById(HttpServletRequest servletRequest, Long id) {
return notificationDao.getNotificationById(id);
}
@Override
public List<NotificationResponse> getNotificationByUserId(HttpServletRequest servletRequest, Long userId, Long companyId, List<NotificationEnum> statuses) {
return notificationDao.getNotificationByUserId(userId,companyId,statuses);
}
@Override
public NotificationResponse updateNotificationStatus(HttpServletRequest request, Long id,NotificationEnum status) {
return notificationDao.updateNotificationStatus(id,status);
}
@Override
public void deleteNotification(HttpServletRequest request, Long id) {
notificationDao.deleteNotification(id);
return;
}
}