diff --git a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/persistence/repository/NotificationRepository.java b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/persistence/repository/NotificationRepository.java index 3346bbb67..7fea3d1e9 100644 --- a/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/persistence/repository/NotificationRepository.java +++ b/persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/persistence/repository/NotificationRepository.java @@ -15,11 +15,19 @@ public interface NotificationRepository extends JpaRepository findAppNotificationsForUser(String userId); - @Query("select n from NotificationEntity n where " + " (exists (select e from NotificationPreferencesEntity e where e.userId = :userId) and n.notificationType in ( select apn from NotificationPreferencesEntity p join p.inAppNotifications apn where p.userId = :userId and p.inAppNotificationsEnabled = true )) " + " and n.seenDate is null and n.softDeleted is null and n.userId = :userId order by n.creationDate desc ") + @Query(""" + select n from NotificationEntity n where + (exists (select e from NotificationPreferencesEntity e where e.userId = :userId) and n.notificationType in + (select apn from NotificationPreferencesEntity p join p.inAppNotifications apn where p.userId = :userId and p.inAppNotificationsEnabled = true)) + and n.seenDate is null and n.softDeleted is null and n.userId = :userId order by n.creationDate desc""") List findUnseenNotificationsForUser(String userId);