@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user