From e6617ce2c82830448f79ba7e82edbfb8b69b49c7 Mon Sep 17 00:00:00 2001 From: young Date: Thu, 6 Aug 2026 14:50:52 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=ED=94=BC=EB=93=9C=EB=B0=B1=20?= =?UTF-8?q?=EB=B9=A8=EA=B0=84=EC=A0=90=20=EC=9D=BD=EC=9D=8C=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20(#131)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/NotificationRepository.java | 20 +++++++++++++++++++ .../service/NotificationService.java | 14 +++++++++++++ .../domain/video/service/VideoService.java | 3 +++ 3 files changed, 37 insertions(+) diff --git a/src/main/java/com/slatto/domain/notification/repository/NotificationRepository.java b/src/main/java/com/slatto/domain/notification/repository/NotificationRepository.java index 5bbe6304..ea0bbf98 100644 --- a/src/main/java/com/slatto/domain/notification/repository/NotificationRepository.java +++ b/src/main/java/com/slatto/domain/notification/repository/NotificationRepository.java @@ -103,6 +103,26 @@ int markAsReadByIdAndUserId( @Param("readAt") LocalDateTime readAt ); + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query(""" + update Notification n + set n.isRead = true, + n.readAt = :readAt + where n.user.id = :userId + and n.type = :type + and n.targetType = :targetType + and n.targetId = :videoId + and n.isRead = false + and n.deletedAt is null + """) + int markVideoFeedbackNotificationsAsRead( + @Param("userId") Long userId, + @Param("type") NotificationType type, + @Param("targetType") String targetType, + @Param("videoId") Long videoId, + @Param("readAt") LocalDateTime readAt + ); + // 동일 대상의 미읽음 그룹 알림을 잠금 조회해 누적 개수와 문구를 같은 엔티티 상태 기준으로 갱신한다. @Lock(LockModeType.PESSIMISTIC_WRITE) @Query(""" diff --git a/src/main/java/com/slatto/domain/notification/service/NotificationService.java b/src/main/java/com/slatto/domain/notification/service/NotificationService.java index eb96b58b..b6ad1ebc 100644 --- a/src/main/java/com/slatto/domain/notification/service/NotificationService.java +++ b/src/main/java/com/slatto/domain/notification/service/NotificationService.java @@ -102,6 +102,20 @@ public void markAllNotificationsAsRead(Long currentUserId) { notificationRepository.markAllAsReadByUserId(currentUserId, LocalDateTime.now()); } + @Transactional + public void markVideoFeedbackNotificationsAsRead(Long userId, Long videoId) { + validateActiveUser(userId); + validateRequiredId(videoId); + + notificationRepository.markVideoFeedbackNotificationsAsRead( + userId, + NotificationType.VIDEO_FEEDBACK_COMMENTED, + NotificationTargetType.VIDEO.name(), + videoId, + LocalDateTime.now() + ); + } + /** * 영상 목록의 미읽은 피드백 누적 개수를 한 번에 조회한다. */ diff --git a/src/main/java/com/slatto/domain/video/service/VideoService.java b/src/main/java/com/slatto/domain/video/service/VideoService.java index 0e150c3c..a35139be 100644 --- a/src/main/java/com/slatto/domain/video/service/VideoService.java +++ b/src/main/java/com/slatto/domain/video/service/VideoService.java @@ -59,6 +59,7 @@ public class VideoService { private final YoutubeUrlParser youtubeUrlParser; private final YoutubeApiClient youtubeApiClient; + @Transactional public VideoDetailResDTO getVideo(Long memberId, Long projectId, Long videoId) { if (!projectAccessRepository.projectExistsById(projectId)) { throw new BaseException(CommonErrorCode.NOT_FOUND); @@ -75,6 +76,8 @@ public VideoDetailResDTO getVideo(Long memberId, Long projectId, Long videoId) { projectAccessRepository.findProjectRoleNames(projectId) ); + notificationService.markVideoFeedbackNotificationsAsRead(memberId, videoId); + return VideoDetailResDTO.from(video, bookmarked, projectTags); } From c0b68ac00ba0fb2ae44a3d0a5674ee435c3558fa Mon Sep 17 00:00:00 2001 From: young Date: Thu, 6 Aug 2026 20:14:09 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EC=BD=94=EB=93=9C=20=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EC=88=98=EC=A0=95=20(#131)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/notification/repository/NotificationRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/slatto/domain/notification/repository/NotificationRepository.java b/src/main/java/com/slatto/domain/notification/repository/NotificationRepository.java index ea0bbf98..dd2c7267 100644 --- a/src/main/java/com/slatto/domain/notification/repository/NotificationRepository.java +++ b/src/main/java/com/slatto/domain/notification/repository/NotificationRepository.java @@ -103,7 +103,7 @@ int markAsReadByIdAndUserId( @Param("readAt") LocalDateTime readAt ); - @Modifying(clearAutomatically = true, flushAutomatically = true) + @Modifying(flushAutomatically = true) @Query(""" update Notification n set n.isRead = true,