From f35c19d2d9d09e33f982cb44515cd842609530db Mon Sep 17 00:00:00 2001 From: Gayeong Park Date: Thu, 4 Jun 2026 20:35:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B3=BC=EA=B1=B0=20=EB=82=A0=EC=A7=9C?= =?UTF-8?q?=20=EB=AA=A9=ED=91=9C=20=EC=9D=B8=EC=A6=9D=20=EC=8B=9C=20GOAL?= =?UTF-8?q?=5FCOMPLETED=20=EC=95=8C=EB=A6=BC=20=EB=94=A5=EB=A7=81=ED=81=AC?= =?UTF-8?q?=EA=B0=80=20=EC=98=A4=EB=8A=98=EB=A1=9C=20=EA=B0=80=EB=8D=98=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GOAL_COMPLETED 알림 딥링크의 date가 인증 날짜가 아닌 LocalDate.now()로 설정되어, 과거 날짜로 인증해도 알림을 누르면 오늘 날짜 화면으로 이동하던 문제 해결. 근본 원인: PhotologCreatedEvent가 verificationDate를 담지 않아 리스너가 LocalDate.now()로 대체하고 있었음. (POKE/REACTION은 이미 verificationDate 사용) - PhotologCreatedEvent에 verificationDate 추가 - PhotoLogService.createPhotolog에서 verificationDate 전달 - handlePhotologCreated 딥링크 date를 event.verificationDate로 변경 - 미사용 LocalDate import 제거, 테스트를 과거 날짜로 검증하도록 수정 --- .../event/NotificationEventListener.kt | 3 +-- .../notification/event/NotificationEvents.kt | 1 + .../application/photolog/PhotoLogService.kt | 4 ++- .../event/NotificationEventListenerTest.kt | 27 +++++++++++++------ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/love/application/src/main/kotlin/com/yapp/love/application/notification/event/NotificationEventListener.kt b/love/application/src/main/kotlin/com/yapp/love/application/notification/event/NotificationEventListener.kt index 05308c1..3a5d0fb 100644 --- a/love/application/src/main/kotlin/com/yapp/love/application/notification/event/NotificationEventListener.kt +++ b/love/application/src/main/kotlin/com/yapp/love/application/notification/event/NotificationEventListener.kt @@ -11,7 +11,6 @@ import org.springframework.scheduling.annotation.Async import org.springframework.stereotype.Component import org.springframework.transaction.event.TransactionPhase import org.springframework.transaction.event.TransactionalEventListener -import java.time.LocalDate private val logger = KotlinLogging.logger {} @@ -79,7 +78,7 @@ class NotificationEventListener( bodyArgs = arrayOf(nickname), deepLinkParams = mapOf( "goalId" to event.goalId.toString(), - "date" to LocalDate.now().toString(), + "date" to event.verificationDate.toString(), ), ) } catch (e: Exception) { diff --git a/love/application/src/main/kotlin/com/yapp/love/application/notification/event/NotificationEvents.kt b/love/application/src/main/kotlin/com/yapp/love/application/notification/event/NotificationEvents.kt index c551117..bbff858 100644 --- a/love/application/src/main/kotlin/com/yapp/love/application/notification/event/NotificationEvents.kt +++ b/love/application/src/main/kotlin/com/yapp/love/application/notification/event/NotificationEvents.kt @@ -18,6 +18,7 @@ data class PokedEvent( data class PhotologCreatedEvent( val userId: Long, val goalId: Long, + val verificationDate: LocalDate, ) data class GoalEndedEvent( diff --git a/love/application/src/main/kotlin/com/yapp/love/application/photolog/PhotoLogService.kt b/love/application/src/main/kotlin/com/yapp/love/application/photolog/PhotoLogService.kt index 3a5246a..514e8b0 100644 --- a/love/application/src/main/kotlin/com/yapp/love/application/photolog/PhotoLogService.kt +++ b/love/application/src/main/kotlin/com/yapp/love/application/photolog/PhotoLogService.kt @@ -122,7 +122,9 @@ class PhotologService( ) ) - notificationEventPublisher.publishEvent(PhotologCreatedEvent(userId = userId, goalId = goalId)) + notificationEventPublisher.publishEvent( + PhotologCreatedEvent(userId = userId, goalId = goalId, verificationDate = verificationDate), + ) return saved } diff --git a/love/application/src/test/kotlin/com/yapp/love/application/notification/event/NotificationEventListenerTest.kt b/love/application/src/test/kotlin/com/yapp/love/application/notification/event/NotificationEventListenerTest.kt index 7f56269..fc80e4c 100644 --- a/love/application/src/test/kotlin/com/yapp/love/application/notification/event/NotificationEventListenerTest.kt +++ b/love/application/src/test/kotlin/com/yapp/love/application/notification/event/NotificationEventListenerTest.kt @@ -118,6 +118,7 @@ class NotificationEventListenerTest : DescribeSpec({ val userId = 1L val partnerId = 2L val goalId = 10L + val verificationDate = LocalDate.of(2026, 1, 15) val coupleInfo = CoupleInfo( id = 100L, @@ -145,7 +146,9 @@ class NotificationEventListenerTest : DescribeSpec({ UserAdditionInfo(userId = userId, nickname = "철수") every { goalRepository.findById(goalId) } returns goal - listener.handlePhotologCreated(PhotologCreatedEvent(userId = userId, goalId = goalId)) + listener.handlePhotologCreated( + PhotologCreatedEvent(userId = userId, goalId = goalId, verificationDate = verificationDate), + ) verify { notificationService.sendNotification( @@ -153,7 +156,7 @@ class NotificationEventListenerTest : DescribeSpec({ type = NotificationType.GOAL_COMPLETED, titleArgs = arrayOf("철수", "운동하기"), bodyArgs = arrayOf("철수"), - deepLinkParams = mapOf("goalId" to "10", "date" to LocalDate.now().toString()), + deepLinkParams = mapOf("goalId" to "10", "date" to verificationDate.toString()), ) } } @@ -172,7 +175,9 @@ class NotificationEventListenerTest : DescribeSpec({ UserAdditionInfo(userId = userId, nickname = "철수") every { goalRepository.findById(goalId) } returns goal - listener.handlePhotologCreated(PhotologCreatedEvent(userId = userId, goalId = goalId)) + listener.handlePhotologCreated( + PhotologCreatedEvent(userId = userId, goalId = goalId, verificationDate = verificationDate), + ) verify { notificationService.sendNotification( @@ -180,7 +185,7 @@ class NotificationEventListenerTest : DescribeSpec({ type = NotificationType.GOAL_COMPLETED, titleArgs = arrayOf("철수", "운동하기"), bodyArgs = arrayOf("철수"), - deepLinkParams = mapOf("goalId" to "10", "date" to LocalDate.now().toString()), + deepLinkParams = mapOf("goalId" to "10", "date" to verificationDate.toString()), ) } } @@ -192,7 +197,9 @@ class NotificationEventListenerTest : DescribeSpec({ every { userAdditionInfoRepository.findByUserId(userId) } returns null every { goalRepository.findById(goalId) } returns goal - listener.handlePhotologCreated(PhotologCreatedEvent(userId = userId, goalId = goalId)) + listener.handlePhotologCreated( + PhotologCreatedEvent(userId = userId, goalId = goalId, verificationDate = verificationDate), + ) verify { notificationService.sendNotification( @@ -200,7 +207,7 @@ class NotificationEventListenerTest : DescribeSpec({ type = NotificationType.GOAL_COMPLETED, titleArgs = arrayOf("상대방", "운동하기"), bodyArgs = arrayOf("상대방"), - deepLinkParams = mapOf("goalId" to "10", "date" to LocalDate.now().toString()), + deepLinkParams = mapOf("goalId" to "10", "date" to verificationDate.toString()), ) } } @@ -210,7 +217,9 @@ class NotificationEventListenerTest : DescribeSpec({ it("알림을 전송하지 않는다") { every { coupleInfoRepository.findByUserId(userId) } returns null - listener.handlePhotologCreated(PhotologCreatedEvent(userId = userId, goalId = goalId)) + listener.handlePhotologCreated( + PhotologCreatedEvent(userId = userId, goalId = goalId, verificationDate = verificationDate), + ) verify(exactly = 0) { notificationService.sendNotification(any(), any(), any(), any(), any()) } } @@ -223,7 +232,9 @@ class NotificationEventListenerTest : DescribeSpec({ UserAdditionInfo(userId = userId, nickname = "철수") every { goalRepository.findById(goalId) } returns null - listener.handlePhotologCreated(PhotologCreatedEvent(userId = userId, goalId = goalId)) + listener.handlePhotologCreated( + PhotologCreatedEvent(userId = userId, goalId = goalId, verificationDate = verificationDate), + ) verify(exactly = 0) { notificationService.sendNotification(any(), any(), any(), any(), any()) } }