notification preferences fix
This commit is contained in:
parent
615e5bba55
commit
f9f9a03186
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user