Created endpoint for get,update,delete
This commit is contained in:
@@ -1,7 +1,20 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.enums.NotificationEnum;
|
||||
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NotificationService {
|
||||
NotificationReq sendNotification(Long userId, NotificationReq notificationReq);
|
||||
NotificationResponse sendNotification(Long userId, NotificationReq notificationReq);
|
||||
|
||||
public NotificationResponse getNotificationById(HttpServletRequest servletRequest,Long id);
|
||||
|
||||
public List<NotificationResponse> getNotificationByUserId(HttpServletRequest servletRequest, Long userId, Long companyId, List<NotificationEnum> statuses);
|
||||
|
||||
public NotificationResponse updateNotificationStatus(HttpServletRequest request,Long id,NotificationEnum status);
|
||||
|
||||
public void deleteNotification(HttpServletRequest request, Long id);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user