Pull request #97: notification preferences fix
Merge in RED/persistence-service from fixes to master * commit '374fde2263304eae9c4c8c33b38b0384d8a1a379': test-fix notification preferences fix
This commit is contained in:
commit
001d0862d3
@ -14,7 +14,6 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
public class NotificationPreferences {
|
||||
|
||||
private String userId;
|
||||
private boolean inAppNotificationsEnabled;
|
||||
private boolean emailNotificationsEnabled;
|
||||
private EmailNotificationType emailNotificationType;
|
||||
|
||||
@ -19,11 +19,10 @@ public class NotificationPreferencesPersistenceService {
|
||||
@Transactional
|
||||
public void setNotificationPreference(String userId, NotificationPreferences notification) {
|
||||
notificationPreferencesRepository.findById(userId)
|
||||
.ifPresentOrElse(n -> {
|
||||
BeanUtils.copyProperties(notification, n);
|
||||
}, () -> {
|
||||
.ifPresentOrElse(n -> BeanUtils.copyProperties(notification, n), () -> {
|
||||
NotificationPreferencesEntity notificationPreferencesEntity = new NotificationPreferencesEntity();
|
||||
BeanUtils.copyProperties(notification, notificationPreferencesEntity);
|
||||
notificationPreferencesEntity.setUserId(userId);
|
||||
notificationPreferencesRepository.save(notificationPreferencesEntity);
|
||||
});
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ public class NotificationPreferencesTest extends AbstractPersistenceServerServic
|
||||
emailNotifications.add(DOSSIER_YOU_OWN_NOTIFICATION_1);
|
||||
emailNotifications.add(DOSSIER_YOU_OWN_NOTIFICATION_2);
|
||||
emailNotifications.add(DOSSIER_YOU_OWN_NOTIFICATION_4);
|
||||
notificationPreferences = new NotificationPreferences(USER_ID, true, true, EmailNotificationType.DAILY, emailNotifications, inAppNotifications);
|
||||
notificationPreferences = new NotificationPreferences(true, true, EmailNotificationType.DAILY, emailNotifications, inAppNotifications);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user