dev add delete method
Test Workflow / test (push) Successful in 2s

This commit is contained in:
vladp
2026-04-07 11:48:20 +07:00
parent d8f6a08a2f
commit e71ce9bc10
3 changed files with 20 additions and 24 deletions
@@ -4,7 +4,7 @@ import lombok.Getter;
@Getter
public enum NotificationMessage {
FILE_SEARCH("notification-file-search");
FILE_SEARCH("notification.file.search");
private final String messageKey;
@@ -4,24 +4,24 @@ import lombok.Getter;
@Getter
public enum NotificationType {
SEARCH_RESULT("notification-search-result"),
MONITORING_RESULT("notification-monitoring-result"),
OPERATION_IMPOSSIBLE("notification-operation-impossible"),
START_FAILED_NOW("notification-start-failed-now"),
START_FAILED_NEXT("notification-start-failed-next"),
PAYOUT_RESULT("notification-payout-result"),
PAYMENT_RESULT("notification-payment-result"),
REFERRAL_DEPOSIT("notification-referral-deposit"),
REFERRAL_REGISTERED("notification-referral-registered"),
REFERRAL_ACTIVATED("notification-referral-activated"),
COMPLAINT_STATUS_CHANGED("notification-complaint-status"),
CASE_STATUS_CHANGED("notification-case-status"),
INCOMING_MESSAGE("notification-incoming-message"),
TARIFF_EXPIRING("notification-tariff-expiring"),
TOKEN_NOT_FOUND("notification-token-not-found"),
FILE_MODERATION_EVENT("notification-file-moderation"),
FILE_ADDED_TO_SYSTEM("notification-file-added"),
SEARCH_OPERATION_FAILED("notification-search-operation-filed");
SEARCH_RESULT("notification.search.result"),
MONITORING_RESULT("notification.monitoring.result"),
OPERATION_IMPOSSIBLE("notification.operation.impossible"),
START_FAILED_NOW("notification.start.failed.now"),
START_FAILED_NEXT("notification.start.failed.next"),
PAYOUT_RESULT("notification.payout.result"),
PAYMENT_RESULT("notification.payment.result"),
REFERRAL_DEPOSIT("notification.referral.deposit"),
REFERRAL_REGISTERED("notification.referral.registered"),
REFERRAL_ACTIVATED("notification.referral.activated"),
COMPLAINT_STATUS_CHANGED("notification.complaint.status"),
CASE_STATUS_CHANGED("notification.case.status"),
INCOMING_MESSAGE("notification.incoming.message"),
TARIFF_EXPIRING("notification.tariff.expiring"),
TOKEN_NOT_FOUND("notification.token.not.found"),
FILE_MODERATION_EVENT("notification.file.moderation"),
FILE_ADDED_TO_SYSTEM("notification.file.added"),
SEARCH_OPERATION_FAILED("notification.search.operation.filed");
private final String messageKey;
@@ -34,16 +34,12 @@ public class NotificationService {
@Transactional
public void addNotification(NotificationType notificationType, long userId, Object... args) {
Locale locale = Locale.forLanguageTag("ru");
String message = messageSource.getMessage(notificationType.getMessageKey(), args, locale);
Notification notification = Notification.builder()
.notificationType(notificationType)
.createdAt(LocalDateTime.now())
.user(userRepository.findById(userId).orElseThrow())
.status(NotificationStatus.NEW)
.message(message)
.message(notificationType.getMessageKey())
.build();
notificationRepository.save(notification);