Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api: ✨ 미확인 푸시 알림 존재 여부 확인 API #139

Merged
merged 11 commits into from
Jul 25, 2024
Merged
Prev Previous commit
Next Next commit
feat: notification service has_unread_notification 메서드 추가
  • Loading branch information
psychology50 committed Jul 25, 2024
commit 5e4d42d795b23ea05db4a6a28a23e8ee2f478e92
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ public class NotificationSearchService {
public Slice<Notification> getNotifications(Long userId, Pageable pageable) {
return notificationService.readNotificationsSlice(userId, pageable);
}

@Transactional(readOnly = true)
public boolean hasUnreadNotification(Long userId) {
return notificationService.readUnreadNotification(userId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public Slice<Notification> readNotificationsSlice(Long userId, Pageable pageable
return SliceUtil.toSlice(notificationRepository.findList(predicate, queryHandler, sort), pageable);
}

@Transactional(readOnly = true)
public boolean readUnreadNotification(Long userId) {
return notificationRepository.existsTopByReceiver_IdAndReadAtIsNull(userId);
}

@Transactional(readOnly = true)
public long countUnreadNotifications(Long userId, List<Long> notificationIds) {
return notificationRepository.countUnreadNotificationsByIds(userId, notificationIds);
Expand Down