Updated Apis, Code, Configurations for Notification.
This commit is contained in:
@@ -23,10 +23,7 @@ public class TendermanagementApplication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCorsMappings(CorsRegistry registry) {
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
//remove after testing
|
registry.addMapping("/**").allowedOrigins("http://localhost:3000").allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD").allowCredentials(true);
|
||||||
//add url for a demo html and js project created on Vs code and ran it from go live on right bottim corner user gepafin_dev_local backup DB for gettng notification on FE.
|
|
||||||
registry.addMapping("/**").allowedOrigins("http://127.0.0.1:5500", "http://localhost:3000", "http://localhost:5500")
|
|
||||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD").allowCredentials(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.gepafin.tendermanagement.config;
|
package net.gepafin.tendermanagement.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||||
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
||||||
@@ -10,23 +11,28 @@ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerCo
|
|||||||
@EnableWebSocketMessageBroker
|
@EnableWebSocketMessageBroker
|
||||||
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
||||||
|
|
||||||
|
@Value("${spring.rabbitmq.host}")
|
||||||
|
private String relayHost;
|
||||||
|
|
||||||
|
@Value("${spring.rabbitmq.port}")
|
||||||
|
private int relayPort;
|
||||||
|
|
||||||
|
@Value("${spring.rabbitmq.username}")
|
||||||
|
private String clientUserName;
|
||||||
|
|
||||||
|
@Value("${spring.rabbitmq.password}")
|
||||||
|
private String clientPassword;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageBroker(MessageBrokerRegistry config) {
|
public void configureMessageBroker(MessageBrokerRegistry config) {
|
||||||
// Enable a simple broker for both /topic (broadcast messages) and /queue (user-specific messages)
|
|
||||||
config.enableStompBrokerRelay("/topic")
|
|
||||||
.setRelayHost("localhost")
|
|
||||||
.setRelayPort(61613) // RabbitMQ is running on port 61613
|
|
||||||
.setClientLogin("guest")
|
|
||||||
.setClientPasscode("guest");
|
|
||||||
|
|
||||||
// Prefix for application messages (user sends messages to /app endpoints)
|
config.enableStompBrokerRelay("/topic").setRelayHost(relayHost).setRelayPort(relayPort).setClientLogin(clientUserName).setClientPasscode(clientPassword);
|
||||||
config.setApplicationDestinationPrefixes("/app");
|
config.setApplicationDestinationPrefixes("/app");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||||
|
|
||||||
registry.addEndpoint("/gs-guide-websocket").setAllowedOrigins("http://127.0.0.1:5501/", "http://localhost:5500", "http://localhost:5501", "http://127.0.0.1:5500/")
|
registry.addEndpoint("/wss").setAllowedOrigins("http://localhost:3000").withSockJS();
|
||||||
.withSockJS();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package net.gepafin.tendermanagement.constants;
|
package net.gepafin.tendermanagement.constants;
|
||||||
|
|
||||||
import com.amazonaws.services.dynamodbv2.xspec.S;
|
|
||||||
|
|
||||||
public class GepafinConstant {
|
public class GepafinConstant {
|
||||||
|
|
||||||
public static final String USER_CREATED_SUCCESS_MSG = "user.created.success";
|
public static final String USER_CREATED_SUCCESS_MSG = "user.created.success";
|
||||||
@@ -353,8 +351,7 @@ public class GepafinConstant {
|
|||||||
public static final String NOTIFICATION_ALREADY_IN_THAT_STATE="notification.already.in.state";
|
public static final String NOTIFICATION_ALREADY_IN_THAT_STATE="notification.already.in.state";
|
||||||
public static final String NOTIFICATION_DELETED_SUCCESSFULLY="notification.deleted.successfully";
|
public static final String NOTIFICATION_DELETED_SUCCESSFULLY="notification.deleted.successfully";
|
||||||
public static final String NOTIFICATION_UPDATED_SUCCESSFULLY="notification.updated.successfully";
|
public static final String NOTIFICATION_UPDATED_SUCCESSFULLY="notification.updated.successfully";
|
||||||
|
public static final String USER_WITH_COMPANY_NOT_FOUND = "user.with.company.not.found";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
|||||||
|
|
||||||
import static net.gepafin.tendermanagement.enums.RoleStatusEnum.ROLE_SUPER_ADMIN;
|
import static net.gepafin.tendermanagement.enums.RoleStatusEnum.ROLE_SUPER_ADMIN;
|
||||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||||
|
import static org.hibernate.internal.util.collections.CollectionHelper.listOf;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CallDao {
|
public class CallDao {
|
||||||
@@ -845,7 +846,8 @@ public class CallDao {
|
|||||||
Map<String, String> placeholders = new HashMap<>();
|
Map<String, String> placeholders = new HashMap<>();
|
||||||
placeholders.put("{{call_name}}", callEntity.getName());
|
placeholders.put("{{call_name}}", callEntity.getName());
|
||||||
userIds.forEach(userId -> {
|
userIds.forEach(userId -> {
|
||||||
NotificationReq notificationReq = notificationDao.createNotificationReq(NotificationTypeEnum.CALL_CREATED.getValue(), placeholders, userId);
|
List<Long> companyIds = notificationDao.getAllCompanyIdsForUser(userId);
|
||||||
|
NotificationReq notificationReq = notificationDao.createNotificationReq(NotificationTypeEnum.CALL_CREATED.getValue(), placeholders, userId, null, companyIds);
|
||||||
notificationDao.sendNotification(notificationReq);
|
notificationDao.sendNotification(notificationReq);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
@@ -19,6 +18,7 @@ import net.gepafin.tendermanagement.repositories.NotificationRepository;
|
|||||||
import net.gepafin.tendermanagement.repositories.NotificationTypeRepository;
|
import net.gepafin.tendermanagement.repositories.NotificationTypeRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.UserRepository;
|
import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
import net.gepafin.tendermanagement.repositories.UserWithCompanyRepository;
|
||||||
|
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
import net.gepafin.tendermanagement.util.Utils;
|
import net.gepafin.tendermanagement.util.Utils;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
@@ -34,6 +34,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.collections.CollectionHelper.listOf;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NotificationDao {
|
public class NotificationDao {
|
||||||
@@ -56,6 +58,9 @@ public class NotificationDao {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompanyDao companyDao;
|
private CompanyDao companyDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationService applicationService;
|
||||||
|
|
||||||
public NotificationResponse sendNotification(NotificationReq notificationReq) {
|
public NotificationResponse sendNotification(NotificationReq notificationReq) {
|
||||||
|
|
||||||
// Ensure userId is properly set in notificationReq if not already
|
// Ensure userId is properly set in notificationReq if not already
|
||||||
@@ -68,7 +73,7 @@ public class NotificationDao {
|
|||||||
log.info("Sending notification to user {} with content: {}", userId, notificationReq.getMessage());
|
log.info("Sending notification to user {} with content: {}", userId, notificationReq.getMessage());
|
||||||
List<Long> companyIds = notificationReq.getCompanyIds();
|
List<Long> companyIds = notificationReq.getCompanyIds();
|
||||||
|
|
||||||
if (companyIds==null || companyIds.isEmpty()) {
|
if (companyIds == null || companyIds.isEmpty()) {
|
||||||
sendToUser(userId, notificationEntity);
|
sendToUser(userId, notificationEntity);
|
||||||
} else {
|
} else {
|
||||||
sendToCompanies(userId, companyIds, notificationEntity);
|
sendToCompanies(userId, companyIds, notificationEntity);
|
||||||
@@ -79,40 +84,50 @@ public class NotificationDao {
|
|||||||
|
|
||||||
private NotificationEntity saveNotification(NotificationReq notificationReq) {
|
private NotificationEntity saveNotification(NotificationReq notificationReq) {
|
||||||
|
|
||||||
NotificationEntity notificationEntity = convertToNotificationEntity(notificationReq);
|
return notificationRepository.save(convertNotificationRequestToNotificationEntity(notificationReq));
|
||||||
return notificationRepository.save(notificationEntity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendToUser(Long userId, NotificationEntity notificationEntity) {
|
private void sendToUser(Long userId, NotificationEntity notificationEntity) {
|
||||||
|
|
||||||
String userChannel = GepafinConstant.COMMON_SINGLE_CHANNEL_PREFIX + userId;
|
String userChannel = GepafinConstant.COMMON_SINGLE_CHANNEL_PREFIX + userId;
|
||||||
log.info("Channel for User {}", userChannel);
|
log.info("Channel for User {}", userChannel);
|
||||||
messagingTemplate.convertAndSend(userChannel, notificationEntity);
|
NotificationResponse notificationResponse = convertNotificationEntityToNotificationResponse(notificationEntity);
|
||||||
|
messagingTemplate.convertAndSend(userChannel, notificationResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendToCompanies(Long userId, List<Long> companyIds, NotificationEntity notificationEntity) {
|
private void sendToCompanies(Long userId, List<Long> companyIds, NotificationEntity notificationEntity) {
|
||||||
// Send notification to each company provided in the companyIds list
|
// Send notification to each company provided in the companyIds list
|
||||||
companyIds.forEach(companyId -> {
|
companyIds.forEach(companyId -> {
|
||||||
|
UserWithCompanyEntity userWithCompany = userWithCompanyRepository.findByUserIdAndCompanyIdAndIsDeletedFalseForNotification(userId, companyId);
|
||||||
String companyChannel = Utils.createChannelForUserAndCompany(userId, companyId);
|
String companyChannel = Utils.createChannelForUserAndCompany(userId, companyId);
|
||||||
log.info("Channel for User and Company {}, {}", userId, companyChannel);
|
log.info("Channel for User and Company {}, {}", userId, companyChannel);
|
||||||
messagingTemplate.convertAndSend(companyChannel, notificationEntity);
|
if (userWithCompany == null) {
|
||||||
|
throw new CustomValidationException(Status.BAD_REQUEST, GepafinConstant.USER_WITH_COMPANY_NOT_FOUND);
|
||||||
|
}
|
||||||
|
notificationEntity.setUserWithCompany(userWithCompany);
|
||||||
|
notificationRepository.save(notificationEntity);
|
||||||
|
NotificationResponse notificationResponse = convertNotificationEntityToNotificationResponse(notificationEntity);
|
||||||
|
messagingTemplate.convertAndSend(companyChannel, notificationResponse);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private NotificationReq convertToNotificationReq(NotificationEntity notificationEntity) {
|
private NotificationResponse convertNotificationEntityToNotificationResponse(NotificationEntity notificationEntity) {
|
||||||
|
|
||||||
NotificationReq notificationReq = new NotificationReq();
|
|
||||||
notificationReq.setId(notificationEntity.getId());
|
|
||||||
notificationReq.setUserId(notificationEntity.getUserId());
|
|
||||||
notificationReq.setStatus(NotificationEnum.UNREAD.getValue());
|
|
||||||
notificationReq.setMessage(notificationEntity.getMessage());
|
|
||||||
notificationReq.setCreatedDate(notificationEntity.getCreatedDate());
|
|
||||||
notificationReq.setUpdatedDate(notificationEntity.getUpdatedDate());
|
|
||||||
return notificationReq;
|
|
||||||
|
|
||||||
|
NotificationResponse notificationResponse = new NotificationResponse();
|
||||||
|
notificationResponse.setId(notificationEntity.getId());
|
||||||
|
notificationResponse.setUserId(notificationEntity.getUserId());
|
||||||
|
notificationResponse.setStatus(notificationEntity.getStatus());
|
||||||
|
notificationResponse.setMessage(notificationEntity.getMessage());
|
||||||
|
notificationResponse.setCreatedDate(notificationEntity.getCreatedDate());
|
||||||
|
notificationResponse.setUpdatedDate(notificationEntity.getUpdatedDate());
|
||||||
|
notificationResponse.setRedirectUrl(notificationEntity.getNotificationType());
|
||||||
|
notificationResponse.setCompanyId(notificationEntity.getUserWithCompany() != null ? notificationEntity.getUserWithCompany().getCompanyId() : null);
|
||||||
|
notificationResponse.setNotificationType(notificationEntity.getNotificationType());
|
||||||
|
notificationResponse.setTitle(notificationEntity.getTitle());
|
||||||
|
return notificationResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NotificationEntity convertToNotificationEntity(NotificationReq notificationReq) {
|
private NotificationEntity convertNotificationRequestToNotificationEntity(NotificationReq notificationReq) {
|
||||||
|
|
||||||
NotificationEntity notificationEntity = new NotificationEntity();
|
NotificationEntity notificationEntity = new NotificationEntity();
|
||||||
String message = notificationReq.getMessage();
|
String message = notificationReq.getMessage();
|
||||||
@@ -120,108 +135,107 @@ public class NotificationDao {
|
|||||||
notificationEntity.setUserId(notificationReq.getUserId());
|
notificationEntity.setUserId(notificationReq.getUserId());
|
||||||
notificationEntity.setStatus(NotificationEnum.UNREAD.getValue());
|
notificationEntity.setStatus(NotificationEnum.UNREAD.getValue());
|
||||||
notificationEntity.setIsDeleted(Boolean.FALSE);
|
notificationEntity.setIsDeleted(Boolean.FALSE);
|
||||||
|
notificationEntity.setUserWithCompany(notificationReq.getUserWithCompanyEntity() != null ? notificationReq.getUserWithCompanyEntity() : null);
|
||||||
notificationEntity.setMessage(message);
|
notificationEntity.setMessage(message);
|
||||||
|
notificationEntity.setTitle(notificationReq.getTitle());
|
||||||
return notificationEntity;
|
return notificationEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationReq createNotificationReq(String notificationType, Map<String, String> placeholders, Long userId) {
|
public NotificationReq createNotificationReq(String notificationType, Map<String, String> placeholders, Long userId, UserWithCompanyEntity userWithCompanyEntity,
|
||||||
|
List<Long> companyIds) {
|
||||||
// Create NotificationReq object
|
// Create NotificationReq object
|
||||||
NotificationReq notificationReq = new NotificationReq();
|
NotificationReq notificationReq = new NotificationReq();
|
||||||
List<Long> companyIds = userWithCompanyRepository.findActiveCompanyIdsByUserId(notificationReq.getUserId());
|
|
||||||
notificationReq.setCompanyIds(companyIds);
|
|
||||||
NotificationTypeEntity notificationTypeEntity = notificationTypeRepository.findByNotificationNameAndIsDeletedFalse(notificationType);
|
NotificationTypeEntity notificationTypeEntity = notificationTypeRepository.findByNotificationNameAndIsDeletedFalse(notificationType);
|
||||||
notificationReq.setNotificationType(notificationType);
|
notificationReq.setNotificationType(notificationType);
|
||||||
String message = Utils.replacePlaceholders(notificationTypeEntity.getJsonTemplate(), placeholders);
|
String message = Utils.replacePlaceholders(notificationTypeEntity.getJsonTemplate(), placeholders);
|
||||||
notificationReq.setMessage(message);
|
notificationReq.setMessage(message);
|
||||||
notificationReq.setUserId(userId);
|
notificationReq.setUserId(userId);
|
||||||
|
notificationReq.setCompanyIds(companyIds);
|
||||||
|
String title = Utils.replacePlaceholders(notificationTypeEntity.getTitle(), placeholders);
|
||||||
|
notificationReq.setTitle(title);
|
||||||
|
notificationReq.setUserWithCompanyEntity(userWithCompanyEntity);
|
||||||
return notificationReq;
|
return notificationReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> sendNotificationToBeneficiary(ApplicationEntity application, NotificationTypeEnum notificationTypeEnum) {
|
public Map<String, String> sendNotificationToBeneficiary(ApplicationEntity application, NotificationTypeEnum notificationTypeEnum) {
|
||||||
|
|
||||||
Map<String, String> placeHolders = new HashMap<>();
|
Map<String, String> placeHolders = new HashMap<>();
|
||||||
placeHolders.put("{{call_name}}", application.getCall().getName());
|
placeHolders.put("{{call_name}}", application.getCall().getName());
|
||||||
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
|
placeHolders.put("{{protocol_number}}", String.valueOf(application.getProtocol().getProtocolNumber()));
|
||||||
NotificationReq notificationReq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, application.getUserId());
|
NotificationReq notificationReq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, application.getUserId(), application.getUserWithCompany(),
|
||||||
|
listOf(application.getCompanyId()));
|
||||||
sendNotification(notificationReq);
|
sendNotification(notificationReq);
|
||||||
return placeHolders;
|
return placeHolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendNotificationToInstructor(Map<String, String> placeHolders, ApplicationEvaluationEntity applicationEvaluationEntity, NotificationTypeEnum notificationTypeEnum) {
|
public void sendNotificationToInstructor(Map<String, String> placeHolders, ApplicationEvaluationEntity applicationEvaluationEntity, NotificationTypeEnum notificationTypeEnum) {
|
||||||
Long instructorId=applicationEvaluationEntity.getUserId();
|
|
||||||
if(instructorId != null){
|
Long instructorId = applicationEvaluationEntity.getUserId();
|
||||||
NotificationReq notificationreq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders,instructorId);
|
ApplicationEntity application = applicationService.validateApplication(applicationEvaluationEntity.getApplicationId());
|
||||||
|
if (instructorId != null) {
|
||||||
|
NotificationReq notificationreq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, instructorId, application.getUserWithCompany(),
|
||||||
|
listOf(application.getCompanyId()));
|
||||||
sendNotification(notificationreq);
|
sendNotification(notificationreq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void sendNotificationToSuperUser(ApplicationEntity application,Map<String,String> placeHolders,NotificationTypeEnum notificationTypeEnum) {
|
public void sendNotificationToSuperUser(ApplicationEntity application, Map<String, String> placeHolders, NotificationTypeEnum notificationTypeEnum) {
|
||||||
List<UserEntity> user=userRepository.findByRoleEntity_RoleTypeAndHubId(RoleStatusEnum.ROLE_SUPER_ADMIN.getValue(), application.getHubId());
|
|
||||||
UserEntity userEntity1=user.get(0);
|
List<UserEntity> user = userRepository.findByRoleEntity_RoleTypeAndHubId(RoleStatusEnum.ROLE_SUPER_ADMIN.getValue(), application.getHubId());
|
||||||
if(userEntity1 != null) {
|
UserEntity userEntity1 = user.get(0);
|
||||||
NotificationReq notificationreq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders,userEntity1.getId());
|
if (userEntity1 != null) {
|
||||||
|
NotificationReq notificationreq = createNotificationReq(notificationTypeEnum.getValue(), placeHolders, userEntity1.getId(), application.getUserWithCompany(),
|
||||||
|
listOf(application.getCompanyId()));
|
||||||
sendNotification(notificationreq);
|
sendNotification(notificationreq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Long> getAllCompanyIdsForUser(Long userId) {
|
||||||
|
|
||||||
|
return userWithCompanyRepository.findActiveCompanyIdsByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
public NotificationResponse getNotificationById(Long id) {
|
public NotificationResponse getNotificationById(Long id) {
|
||||||
|
|
||||||
NotificationEntity notificationEntity = validateNotificationEntity(id);
|
NotificationEntity notificationEntity = validateNotificationEntity(id);
|
||||||
NotificationResponse notificationReq=convertNotificationEntityToNotificationResponse(notificationEntity);
|
return convertNotificationEntityToNotificationResponse(notificationEntity);
|
||||||
return notificationReq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private NotificationEntity validateNotificationEntity(Long id) {
|
private NotificationEntity validateNotificationEntity(Long id) {
|
||||||
NotificationEntity notificationEntity=notificationRepository.findByIdAndIsDeletedFalse(id);
|
|
||||||
if(notificationEntity ==null){
|
NotificationEntity notificationEntity = notificationRepository.findByIdAndIsDeletedFalse(id);
|
||||||
|
if (notificationEntity == null) {
|
||||||
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.NOTIFICATION_NOT_FOUND));
|
throw new CustomValidationException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.NOTIFICATION_NOT_FOUND));
|
||||||
}
|
}
|
||||||
return notificationEntity;
|
return notificationEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<NotificationResponse> getNotificationByUserId(Long userId, Long companyId, List<NotificationEnum> statuses) {
|
public List<NotificationResponse> getNotificationByUserId(Long userId, Long companyId, List<NotificationEnum> statuses) {
|
||||||
|
|
||||||
List<NotificationEntity> notificationEntities = notificationRepository.findByUserIdAndIsDeletedFalse(userId);
|
List<NotificationEntity> notificationEntities = notificationRepository.findByUserIdAndIsDeletedFalse(userId);
|
||||||
UserWithCompanyEntity userWithCompany=null;
|
UserWithCompanyEntity userWithCompany = null;
|
||||||
List<String> statusStrings=new ArrayList<>();
|
List<String> statusStrings = new ArrayList<>();
|
||||||
if(companyId!=null){
|
if (companyId != null) {
|
||||||
userWithCompany=companyDao.validateUserWithCompny(userId,companyId);
|
userWithCompany = companyDao.validateUserWithCompny(userId, companyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statuses != null ) {
|
if (statuses != null) {
|
||||||
statusStrings = statuses.stream()
|
statusStrings = statuses.stream().map(NotificationEnum::name) // Convert enum to its name as String
|
||||||
.map(NotificationEnum::name) // Convert enum to its name as String
|
|
||||||
.toList();
|
.toList();
|
||||||
notificationEntities = notificationRepository.findByUserIdAndIsDeletedFalseAndStatusIn(userId,statusStrings);
|
notificationEntities = notificationRepository.findByUserIdAndIsDeletedFalseAndStatusIn(userId, statusStrings);
|
||||||
|
|
||||||
if(userWithCompany != null){
|
if (userWithCompany != null) {
|
||||||
notificationEntities = notificationRepository.findByUserIdAndUserWithCompanyIdAndIsDeletedFalseAndStatusIn(userId, userWithCompany.getId(), statusStrings);
|
notificationEntities = notificationRepository.findByUserIdAndUserWithCompanyIdAndIsDeletedFalseAndStatusIn(userId, userWithCompany.getId(), statusStrings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<NotificationResponse> notificationReq= notificationEntities.stream()
|
return notificationEntities.stream().map(this::convertNotificationEntityToNotificationResponse).collect(Collectors.toList());
|
||||||
.map(this::convertNotificationEntityToNotificationResponse)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
return notificationReq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationResponse convertNotificationEntityToNotificationResponse(NotificationEntity entity) {
|
public NotificationResponse updateNotificationStatus(Long id, NotificationEnum status) {
|
||||||
if (entity == null) {
|
|
||||||
return null; // Handle null entity gracefully
|
|
||||||
}
|
|
||||||
|
|
||||||
NotificationResponse response = new NotificationResponse();
|
NotificationEntity notificationEntity = validateNotificationEntity(id);
|
||||||
response.setId(entity.getId());
|
if (notificationEntity.getStatus().equals(status.getValue())) {
|
||||||
response.setUserId(entity.getUserId());
|
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.NOTIFICATION_ALREADY_IN_THAT_STATE));
|
||||||
response.setMessage(entity.getMessage());
|
|
||||||
response.setNotificationType(entity.getNotificationType());
|
|
||||||
response.setStatus(entity.getStatus());
|
|
||||||
response.setCreatedDate(entity.getCreatedDate());
|
|
||||||
response.setUpdatedDate(entity.getUpdatedDate());
|
|
||||||
response.setRedirectUrl(entity.getRedirectLink());
|
|
||||||
response.setCompanyId(entity.getUserWithCompanyId());
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
public NotificationResponse updateNotificationStatus(Long id,NotificationEnum status){
|
|
||||||
NotificationEntity notificationEntity=validateNotificationEntity(id);
|
|
||||||
if(notificationEntity.getStatus().equals(status.getValue())){
|
|
||||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.NOTIFICATION_ALREADY_IN_THAT_STATE));
|
|
||||||
}
|
}
|
||||||
notificationEntity.setStatus(status.getValue());
|
notificationEntity.setStatus(status.getValue());
|
||||||
notificationEntity.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
notificationEntity.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||||
@@ -229,8 +243,9 @@ public class NotificationDao {
|
|||||||
return convertNotificationEntityToNotificationResponse(notificationEntity);
|
return convertNotificationEntityToNotificationResponse(notificationEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteNotification(Long id){
|
public void deleteNotification(Long id) {
|
||||||
NotificationEntity notificationEntity=validateNotificationEntity(id);
|
|
||||||
|
NotificationEntity notificationEntity = validateNotificationEntity(id);
|
||||||
notificationEntity.setIsDeleted(true);
|
notificationEntity.setIsDeleted(true);
|
||||||
notificationRepository.save(notificationEntity);
|
notificationRepository.save(notificationEntity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package net.gepafin.tendermanagement.entities;
|
|||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -11,23 +13,27 @@ import lombok.Data;
|
|||||||
public class NotificationEntity extends BaseEntity {
|
public class NotificationEntity extends BaseEntity {
|
||||||
|
|
||||||
@Column(name = "USER_ID")
|
@Column(name = "USER_ID")
|
||||||
Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@Column(name = "MESSAGE")
|
@Column(name = "MESSAGE")
|
||||||
String message;
|
private String message;
|
||||||
|
|
||||||
|
@Column(name = "TITLE")
|
||||||
|
private String title;
|
||||||
|
|
||||||
@Column(name = "STATUS")
|
@Column(name = "STATUS")
|
||||||
String status;
|
private String status;
|
||||||
|
|
||||||
@Column(name = "IS_DELETED")
|
@Column(name = "IS_DELETED")
|
||||||
Boolean isDeleted;
|
private Boolean isDeleted;
|
||||||
|
|
||||||
@Column(name = "NOTIFICATION_TYPE")
|
@Column(name = "NOTIFICATION_TYPE")
|
||||||
String notificationType;
|
private String notificationType;
|
||||||
|
|
||||||
@Column(name = "REDIRECT_LINK")
|
@Column(name = "REDIRECT_LINK")
|
||||||
String redirectLink;
|
private String redirectLink;
|
||||||
|
|
||||||
@Column(name = "USER_WITH_COMPANY_ID")
|
@ManyToOne
|
||||||
Long userWithCompanyId;
|
@JoinColumn(name = "USER_WITH_COMPANY_ID")
|
||||||
|
private UserWithCompanyEntity userWithCompany;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,13 @@ import lombok.Data;
|
|||||||
public class NotificationTypeEntity extends BaseEntity {
|
public class NotificationTypeEntity extends BaseEntity {
|
||||||
|
|
||||||
@Column(name = "NOTIFICATION_NAME")
|
@Column(name = "NOTIFICATION_NAME")
|
||||||
String notificationName;
|
private String notificationName;
|
||||||
|
|
||||||
@Column(name = "JSON_TEMPLATE")
|
@Column(name = "JSON_TEMPLATE")
|
||||||
String jsonTemplate;
|
private String jsonTemplate;
|
||||||
|
|
||||||
|
@Column(name = "TITLE")
|
||||||
|
private String title;
|
||||||
|
|
||||||
@Column(name="IS_DELETED")
|
@Column(name="IS_DELETED")
|
||||||
private Boolean isDeleted;
|
private Boolean isDeleted;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package net.gepafin.tendermanagement.model.request;
|
package net.gepafin.tendermanagement.model.request;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -30,8 +32,14 @@ public class NotificationReq {
|
|||||||
private LocalDateTime updatedDate;
|
private LocalDateTime updatedDate;
|
||||||
|
|
||||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
String redirectUrl;
|
private String redirectUrl;
|
||||||
|
|
||||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
List<Long> companyIds;
|
private String title;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
private List<Long> companyIds;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private UserWithCompanyEntity userWithCompanyEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
package net.gepafin.tendermanagement.model.response;
|
package net.gepafin.tendermanagement.model.response;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import net.gepafin.tendermanagement.model.BaseBean;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class NotificationResponse {
|
public class NotificationResponse extends BaseBean {
|
||||||
private Long id;
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
private String message;
|
private String message;
|
||||||
private String notificationType;
|
|
||||||
private String status;
|
private String status;
|
||||||
private LocalDateTime createdDate;
|
|
||||||
private LocalDateTime updatedDate;
|
|
||||||
private String redirectUrl;
|
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
private String redirectUrl;
|
||||||
|
|
||||||
|
private String notificationType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
package net.gepafin.tendermanagement.repositories;
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.entities.NotificationEntity;
|
import net.gepafin.tendermanagement.entities.NotificationEntity;
|
||||||
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface NotificationRepository extends JpaRepository<NotificationEntity, Long> {
|
public interface NotificationRepository extends JpaRepository<NotificationEntity, Long> {
|
||||||
|
|
||||||
NotificationEntity findByIdAndIsDeletedFalse(Long id);
|
NotificationEntity findByIdAndIsDeletedFalse(Long id);
|
||||||
|
|
||||||
List<NotificationEntity> findByUserIdAndIsDeletedFalse(Long userId);
|
List<NotificationEntity> findByUserIdAndIsDeletedFalse(Long userId);
|
||||||
|
|
||||||
List<NotificationEntity> findByUserIdAndUserWithCompanyIdAndIsDeletedFalseAndStatusIn(Long userId,Long
|
List<NotificationEntity> findByUserIdAndUserWithCompanyIdAndIsDeletedFalseAndStatusIn(Long userId, Long userWithCompanyId, List<String> statuses);
|
||||||
userWithCompanyId,List<String> statuses);
|
|
||||||
|
|
||||||
List<NotificationEntity> findByUserIdAndIsDeletedFalseAndStatusIn(Long userId, List<String> statuses);
|
List<NotificationEntity> findByUserIdAndIsDeletedFalseAndStatusIn(Long userId, List<String> statuses);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,23 @@
|
|||||||
package net.gepafin.tendermanagement.repositories;
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
import java.util.List;
|
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.entities.UserWithCompanyEntity;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface UserWithCompanyRepository extends JpaRepository<UserWithCompanyEntity, Long> {
|
public interface UserWithCompanyRepository extends JpaRepository<UserWithCompanyEntity, Long> {
|
||||||
|
|
||||||
void deleteByCompanyIdAndIsDeletedFalse(Long companyId);
|
void deleteByCompanyIdAndIsDeletedFalse(Long companyId);
|
||||||
|
|
||||||
@Query("SELECT u.companyId FROM UserWithCompanyEntity u WHERE u.userId = :userId AND u.isDeleted = false")
|
@Query("SELECT u.companyId FROM UserWithCompanyEntity u WHERE u.userId = :userId AND u.isDeleted = false")
|
||||||
List<Long> findActiveCompanyIdsByUserId(@Param("userId") Long userId);
|
List<Long> findActiveCompanyIdsByUserId(@Param("userId") Long userId);
|
||||||
|
|
||||||
Optional<UserWithCompanyEntity> findByUserIdAndCompanyIdAndIsDeletedFalse(Long userId, Long companyId);
|
Optional<UserWithCompanyEntity> findByUserIdAndCompanyIdAndIsDeletedFalse(Long userId, Long companyId);
|
||||||
|
|
||||||
|
@Query("SELECT u FROM UserWithCompanyEntity u WHERE u.userId = :userId AND u.companyId = :companyId AND u.isDeleted = false")
|
||||||
|
UserWithCompanyEntity findByUserIdAndCompanyIdAndIsDeletedFalseForNotification(Long userId, Long companyId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface NotificationService {
|
public interface NotificationService {
|
||||||
NotificationResponse sendNotification(Long userId, NotificationReq notificationReq);
|
NotificationResponse sendNotification(Long userId, NotificationReq notificationReq, Long companyId);
|
||||||
|
|
||||||
public NotificationResponse getNotificationById(HttpServletRequest servletRequest,Long id);
|
public NotificationResponse getNotificationById(HttpServletRequest servletRequest, Long id);
|
||||||
|
|
||||||
public List<NotificationResponse> getNotificationByUserId(HttpServletRequest servletRequest, Long userId, Long companyId, List<NotificationEnum> statuses);
|
public List<NotificationResponse> getNotificationByUserId(HttpServletRequest servletRequest, Long userId, Long companyId, List<NotificationEnum> statuses);
|
||||||
|
|
||||||
public NotificationResponse updateNotificationStatus(HttpServletRequest request,Long id,NotificationEnum status);
|
public NotificationResponse updateNotificationStatus(HttpServletRequest request, Long id, NotificationEnum status);
|
||||||
|
|
||||||
public void deleteNotification(HttpServletRequest request, Long id);
|
public void deleteNotification(HttpServletRequest request, Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.collections.CollectionHelper.listOf;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NotificationServiceImpl implements NotificationService {
|
public class NotificationServiceImpl implements NotificationService {
|
||||||
@@ -20,33 +22,37 @@ public class NotificationServiceImpl implements NotificationService {
|
|||||||
private NotificationDao notificationDao;
|
private NotificationDao notificationDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NotificationResponse sendNotification(Long userId, NotificationReq notificationReq) {
|
public NotificationResponse sendNotification(Long userId, NotificationReq notificationReq, Long companyId) {
|
||||||
|
|
||||||
log.info("Sending notification to user {} with content: {}", userId, notificationReq.getMessage());
|
log.info("Sending notification to user {} with content: {}", userId, notificationReq.getMessage());
|
||||||
notificationReq.setUserId(userId);
|
notificationReq.setUserId(userId);
|
||||||
NotificationResponse notificationResponse = notificationDao.sendNotification(notificationReq);
|
notificationReq.setCompanyIds(listOf(companyId));
|
||||||
return notificationResponse;
|
return notificationDao.sendNotification(notificationReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NotificationResponse getNotificationById(HttpServletRequest servletRequest, Long id) {
|
public NotificationResponse getNotificationById(HttpServletRequest servletRequest, Long id) {
|
||||||
|
|
||||||
return notificationDao.getNotificationById(id);
|
return notificationDao.getNotificationById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NotificationResponse> getNotificationByUserId(HttpServletRequest servletRequest, Long userId, Long companyId, List<NotificationEnum> statuses) {
|
public List<NotificationResponse> getNotificationByUserId(HttpServletRequest servletRequest, Long userId, Long companyId, List<NotificationEnum> statuses) {
|
||||||
return notificationDao.getNotificationByUserId(userId,companyId,statuses);
|
|
||||||
|
return notificationDao.getNotificationByUserId(userId, companyId, statuses);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NotificationResponse updateNotificationStatus(HttpServletRequest request, Long id,NotificationEnum status) {
|
public NotificationResponse updateNotificationStatus(HttpServletRequest request, Long id, NotificationEnum status) {
|
||||||
return notificationDao.updateNotificationStatus(id,status);
|
|
||||||
|
return notificationDao.updateNotificationStatus(id, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteNotification(HttpServletRequest request, Long id) {
|
public void deleteNotification(HttpServletRequest request, Long id) {
|
||||||
notificationDao.deleteNotification(id);
|
|
||||||
return;
|
notificationDao.deleteNotification(id);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -19,19 +19,15 @@ import com.fasterxml.jackson.annotation.PropertyAccessor;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import io.jsonwebtoken.Claims;
|
|
||||||
import jakarta.persistence.ManyToMany;
|
import jakarta.persistence.ManyToMany;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.OneToMany;
|
||||||
import jakarta.persistence.OneToOne;
|
import jakarta.persistence.OneToOne;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
@@ -48,7 +44,6 @@ import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientForbiddenExce
|
|||||||
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientNotFoundException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientNotFoundException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientUnauthorizedException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientUnauthorizedException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientValidationException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.FeignClientValidationException;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.mock.web.MockHttpServletRequest;
|
import org.springframework.mock.web.MockHttpServletRequest;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|||||||
@@ -7,10 +7,7 @@ import io.swagger.v3.oas.annotations.media.ExampleObject;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.enums.NotificationEnum;
|
import net.gepafin.tendermanagement.enums.NotificationEnum;
|
||||||
import net.gepafin.tendermanagement.enums.NotificationTypeEnum;
|
|
||||||
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||||
import net.gepafin.tendermanagement.model.response.ApplicationGetResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.model.response.LookUpDataResponseBean;
|
|
||||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||||
@@ -36,56 +33,55 @@ public interface NotificationApi {
|
|||||||
ErrorConstants.BADREQUEST_ERROR_EXAMPLE))) })
|
ErrorConstants.BADREQUEST_ERROR_EXAMPLE))) })
|
||||||
@PostMapping(value = "/user/{userId}/sent", consumes = "application/json", produces = "application/json")
|
@PostMapping(value = "/user/{userId}/sent", consumes = "application/json", produces = "application/json")
|
||||||
ResponseEntity<Response<NotificationResponse>> sendNotification(HttpServletRequest request, @RequestBody NotificationReq notificationReq,
|
ResponseEntity<Response<NotificationResponse>> sendNotification(HttpServletRequest request, @RequestBody NotificationReq notificationReq,
|
||||||
|
@Parameter(description = "The company id", required = false) @RequestParam(value = "companyId", required = false) Long companyId,
|
||||||
@Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId);
|
@Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId);
|
||||||
|
|
||||||
@Operation(summary = "Api to get notification by id",
|
@Operation(summary = "Api to get notification by id", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
responses = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
|
||||||
@GetMapping(value = "/{id}", produces = "application/json")
|
@GetMapping(value = "/{id}", produces = "application/json")
|
||||||
ResponseEntity<Response<NotificationResponse>> getNotificationById(HttpServletRequest request, @Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id);
|
ResponseEntity<Response<NotificationResponse>> getNotificationById(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id);
|
||||||
|
|
||||||
@Operation(summary = "Api to get notification by user id",
|
@Operation(summary = "Api to get notification by user id", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
responses = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
|
||||||
@GetMapping(value = "/user/{userId}", produces = "application/json")
|
@GetMapping(value = "/user/{userId}", produces = "application/json")
|
||||||
ResponseEntity<Response<List<NotificationResponse>>> getNotificationByUserId(HttpServletRequest request, @Parameter(description = "The user id", required = true) @PathVariable(value = "userId", required = true) Long userId,@Parameter(description = "The company id", required = false) @RequestParam(value = "companyId",required = false) Long companyId,@Parameter(description = "The notification status", required = false) @RequestParam(value = "status",required = false) List<NotificationEnum> statuses);
|
ResponseEntity<Response<List<NotificationResponse>>> getNotificationByUserId(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The user id", required = true) @PathVariable(value = "userId", required = true) Long userId,
|
||||||
|
@Parameter(description = "The company id", required = false) @RequestParam(value = "companyId", required = false) Long companyId,
|
||||||
|
@Parameter(description = "The notification status", required = false) @RequestParam(value = "status", required = false) List<NotificationEnum> statuses);
|
||||||
|
|
||||||
@Operation(summary = "Api to update notification status",
|
@Operation(summary = "Api to update notification status", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
responses = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
|
||||||
@PutMapping(value = "/{id}", produces = "application/json")
|
@PutMapping(value = "/{id}", produces = "application/json")
|
||||||
ResponseEntity<Response<NotificationResponse>> updateNotificationStatus(HttpServletRequest request, @Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id,@Parameter(description = "The notification status", required = true) @RequestParam(value = "status",required = true) NotificationEnum status);
|
ResponseEntity<Response<NotificationResponse>> updateNotificationStatus(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id,
|
||||||
|
@Parameter(description = "The notification status", required = true) @RequestParam(value = "status", required = true) NotificationEnum status);
|
||||||
|
|
||||||
|
@Operation(summary = "Api to delete notification", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@Operation(summary = "Api to delete notification",
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
responses = {
|
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
|
||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
|
||||||
@DeleteMapping(value = "/{id}", produces = "application/json")
|
@DeleteMapping(value = "/{id}", produces = "application/json")
|
||||||
ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request, @Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id);
|
ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request,
|
||||||
|
@Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.collections.CollectionHelper.listOf;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("${openapi.gepafin.base-path:/v1/notification}")
|
@RequestMapping("${openapi.gepafin.base-path:/v1/notification}")
|
||||||
public class NotificationApiController implements NotificationApi {
|
public class NotificationApiController implements NotificationApi {
|
||||||
@@ -26,41 +28,43 @@ public class NotificationApiController implements NotificationApi {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private NotificationService notificationService;
|
private NotificationService notificationService;
|
||||||
|
|
||||||
public ResponseEntity<Response<NotificationResponse>> sendNotification(HttpServletRequest request, NotificationReq notificationReq, Long userId) {
|
public ResponseEntity<Response<NotificationResponse>> sendNotification(HttpServletRequest request, NotificationReq notificationReq, Long userId, Long companyId) {
|
||||||
|
|
||||||
NotificationResponse notificationData = notificationService.sendNotification(userId, notificationReq);
|
NotificationResponse notificationData = notificationService.sendNotification(userId, notificationReq, companyId);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(notificationData, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_SENT_SUCCESSFULLY)));
|
||||||
.body(new Response<>(notificationData, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_SENT_SUCCESSFULLY)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<NotificationResponse>> getNotificationById(HttpServletRequest request, Long id) {
|
public ResponseEntity<Response<NotificationResponse>> getNotificationById(HttpServletRequest request, Long id) {
|
||||||
NotificationResponse notificationResponse=notificationService.getNotificationById(request,id);
|
|
||||||
|
NotificationResponse notificationResponse = notificationService.getNotificationById(request, id);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(notificationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
.body(new Response<>(notificationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<List<NotificationResponse>>> getNotificationByUserId(HttpServletRequest request, Long userId, Long companyId, List<NotificationEnum> statuses) {
|
public ResponseEntity<Response<List<NotificationResponse>>> getNotificationByUserId(HttpServletRequest request, Long userId, Long companyId, List<NotificationEnum> statuses) {
|
||||||
List<NotificationResponse> notificationResponses=notificationService.getNotificationByUserId(request,userId,companyId,statuses);
|
|
||||||
|
List<NotificationResponse> notificationResponses = notificationService.getNotificationByUserId(request, userId, companyId, statuses);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<List<NotificationResponse>>(notificationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
.body(new Response<List<NotificationResponse>>(notificationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<NotificationResponse>> updateNotificationStatus(HttpServletRequest request, Long id,NotificationEnum notificationEnums) {
|
public ResponseEntity<Response<NotificationResponse>> updateNotificationStatus(HttpServletRequest request, Long id, NotificationEnum notificationEnums) {
|
||||||
NotificationResponse notificationResponse=notificationService.updateNotificationStatus(request,id,notificationEnums);
|
|
||||||
|
NotificationResponse notificationResponse = notificationService.updateNotificationStatus(request, id, notificationEnums);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(notificationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_UPDATED_SUCCESSFULLY)));
|
.body(new Response<>(notificationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_UPDATED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request, Long id) {
|
public ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request, Long id) {
|
||||||
notificationService.deleteNotification(request,id);
|
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
notificationService.deleteNotification(request, id);
|
||||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_DELETED_SUCCESSFULLY)));
|
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_DELETED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -22,4 +22,11 @@ appointment.portal.user=UtenzaAPIPortal@621
|
|||||||
appointment.portal.password=u13nzaAP1P0rtal
|
appointment.portal.password=u13nzaAP1P0rtal
|
||||||
appointment.portal.source=GEPAFINPORTAL
|
appointment.portal.source=GEPAFINPORTAL
|
||||||
appointment.portal.context=GEPAFINPORTAL
|
appointment.portal.context=GEPAFINPORTAL
|
||||||
flagDaFirmare=false
|
flagDaFirmare=false
|
||||||
|
|
||||||
|
# RabbitMQ properties for STOMP broker relay for Notification
|
||||||
|
spring.rabbitmq.host=localhost
|
||||||
|
spring.rabbitmq.port=61613
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
spring.rabbitmq.virtual-host=/
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# DataSource Configuration
|
# DataSource Configuration
|
||||||
spring.datasource.url=jdbc:postgresql://localhost:5432/gepafin_dev_local
|
spring.datasource.url=jdbc:postgresql://localhost:5432/gepafin_dev_local
|
||||||
spring.datasource.username=root
|
spring.datasource.username=postgres
|
||||||
spring.datasource.password=root
|
spring.datasource.password=root
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
|
|
||||||
@@ -22,9 +22,9 @@ appointment.portal.source=GEPAFINPORTAL
|
|||||||
appointment.portal.context=GEPAFINPORTAL
|
appointment.portal.context=GEPAFINPORTAL
|
||||||
flagDaFirmare=false
|
flagDaFirmare=false
|
||||||
|
|
||||||
# RabbitMQ properties for STOMP broker relay
|
# RabbitMQ properties for STOMP broker relay for Notification
|
||||||
spring.rabbitmq.host=localhost
|
spring.rabbitmq.host=localhost
|
||||||
spring.rabbitmq.port=5672
|
spring.rabbitmq.port=61613
|
||||||
spring.rabbitmq.username=guest
|
spring.rabbitmq.username=guest
|
||||||
spring.rabbitmq.password=guest
|
spring.rabbitmq.password=guest
|
||||||
spring.rabbitmq.virtual-host=/
|
spring.rabbitmq.virtual-host=/
|
||||||
@@ -29,4 +29,11 @@ appointment.portal.user=UtenzaAPIPortal@621
|
|||||||
appointment.portal.password=u13nzaAP1P0rtal
|
appointment.portal.password=u13nzaAP1P0rtal
|
||||||
appointment.portal.source=GEPAFINPORTAL
|
appointment.portal.source=GEPAFINPORTAL
|
||||||
appointment.portal.context=GEPAFINPORTAL
|
appointment.portal.context=GEPAFINPORTAL
|
||||||
flagDaFirmare=true
|
flagDaFirmare=true
|
||||||
|
|
||||||
|
# RabbitMQ properties for STOMP broker relay for Notification
|
||||||
|
spring.rabbitmq.host=localhost
|
||||||
|
spring.rabbitmq.port=61613
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
spring.rabbitmq.virtual-host=/
|
||||||
@@ -11,4 +11,18 @@ default_System_Receiver_Email=test@test.test
|
|||||||
gepafin_email=test@test.test
|
gepafin_email=test@test.test
|
||||||
rinaldo_email=test@test.test
|
rinaldo_email=test@test.test
|
||||||
carlo_email=test@test.test
|
carlo_email=test@test.test
|
||||||
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
default.hub.uuid=p4lk3bcx1RStqTaIVVbXs
|
||||||
|
|
||||||
|
appointment.base.url=https://demo.galileonetwork.it/gateway/rest
|
||||||
|
appointment.portal.user=UtenzaAPIPortal@621
|
||||||
|
appointment.portal.password=u13nzaAP1P0rtal
|
||||||
|
appointment.portal.source=GEPAFINPORTAL
|
||||||
|
appointment.portal.context=GEPAFINPORTAL
|
||||||
|
flagDaFirmare=false
|
||||||
|
|
||||||
|
# RabbitMQ properties for STOMP broker relay for Notification
|
||||||
|
spring.rabbitmq.host=localhost
|
||||||
|
spring.rabbitmq.port=61613
|
||||||
|
spring.rabbitmq.username=guest
|
||||||
|
spring.rabbitmq.password=guest
|
||||||
|
spring.rabbitmq.virtual-host=/
|
||||||
@@ -2030,9 +2030,19 @@
|
|||||||
<sqlFile dbms="postgresql"
|
<sqlFile dbms="postgresql"
|
||||||
path="db/dump/insert_json_template_for_notification_13_12_2024.sql"/>
|
path="db/dump/insert_json_template_for_notification_13_12_2024.sql"/>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
<changeSet id="23-12-2024" author="Piyush Kag">
|
|
||||||
|
<changeSet id="23-12-2024_1" author="Piyush Kag">
|
||||||
<addColumn tableName="notification">
|
<addColumn tableName="notification">
|
||||||
<column name="user_with_company_id" type="INTEGER"></column>
|
<column name="USER_WITH_COMPANY_ID" type="INTEGER">
|
||||||
|
<constraints nullable="true" foreignKeyName="fk_USER_WITH_COMPANY_NOTIFICATION" references="user_with_company(id)"/>
|
||||||
|
</column>
|
||||||
</addColumn>
|
</addColumn>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="23-12-2024_2" author="Piyush Kag">
|
||||||
|
<addColumn tableName="notification">
|
||||||
|
<column name="title" type="TEXT"/>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -343,3 +343,4 @@ notification.not.found=Notification not found.
|
|||||||
notification.sent.successfully=Notification sent successfully.
|
notification.sent.successfully=Notification sent successfully.
|
||||||
notification.deleted.successfully=Notification deleted successfully.
|
notification.deleted.successfully=Notification deleted successfully.
|
||||||
notification.updated.successfully=Notification updated successfully.
|
notification.updated.successfully=Notification updated successfully.
|
||||||
|
user.with.company.not.found = User with company not found for user or company.
|
||||||
|
|||||||
@@ -332,4 +332,5 @@ notification.fetched.successfully=Notifica recuperata con successo.
|
|||||||
notification.not.found=Notifica non trovata.
|
notification.not.found=Notifica non trovata.
|
||||||
notification.sent.successfully=Notifica inviata con successo.
|
notification.sent.successfully=Notifica inviata con successo.
|
||||||
notification.deleted.successfully=Notifica eliminata con successo.
|
notification.deleted.successfully=Notifica eliminata con successo.
|
||||||
notification.updated.successfully=Notifica aggiornata con successo.
|
notification.updated.successfully=Notifica aggiornata con successo.
|
||||||
|
user.with.company.not.found = Utente con azienda non trovato per utente o azienda.
|
||||||
Reference in New Issue
Block a user