Skip to content

Commit 6ed4664

Browse files
committed
CLAP-411 Fix : 미확인 알림 개수 조회 오류 해결
1 parent f95426d commit 6ed4664

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/clap/server/adapter/outbound/persistense/NotificationPersistenceAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public List<Notification> findNotificationsByTaskId(Long taskId) {
5151

5252
@Override
5353
public Integer countNotification(final Long memberId) {
54-
return notificationRepository.countByIsReadFalseAndReceiver_MemberId(memberId);
54+
return notificationRepository.countUnreadByMemberId(memberId);
5555
}
5656

5757
@Override

src/main/java/clap/server/adapter/outbound/persistense/repository/notification/NotificationRepository.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@ Slice<NotificationEntity> findAllByReceiver_MemberIdOrderByCreatedAtDesc(
2929

3030
List<NotificationEntity> findByTask_TaskId(Long taskId);
3131

32-
Integer countByIsReadFalseAndReceiver_MemberId(Long memberId);
32+
@Query("SELECT COUNT(n) FROM NotificationEntity n " +
33+
"WHERE n.isRead = false " +
34+
"AND n.receiver.memberId = :memberId " +
35+
"AND n.task.isDeleted = false")
36+
Integer countUnreadByMemberId(@Param("memberId") Long memberId);
3337
}

0 commit comments

Comments
 (0)