diff --git a/backend/src/main/java/com/ody/mate/service/MateService.java b/backend/src/main/java/com/ody/mate/service/MateService.java index ea565207b..af05af3c1 100644 --- a/backend/src/main/java/com/ody/mate/service/MateService.java +++ b/backend/src/main/java/com/ody/mate/service/MateService.java @@ -20,6 +20,7 @@ import com.ody.notification.domain.types.Entry; import com.ody.notification.domain.types.MateLeave; import com.ody.notification.domain.types.MemberDeletion; +import com.ody.notification.domain.types.Nudge; import com.ody.notification.service.NotificationService; import com.ody.route.domain.DepartureTime; import com.ody.route.domain.RouteTime; @@ -102,7 +103,8 @@ public void nudge(NudgeRequest nudgeRequest) { Mate requestMate = findFetchedMate(nudgeRequest.requestMateId()); Mate nudgedMate = findFetchedMate(nudgeRequest.nudgedMateId()); validateNudgeCondition(requestMate, nudgedMate); - notificationService.sendNudgeMessage(requestMate, nudgedMate); + Nudge nudge = new Nudge(nudgedMate); + notificationService.sendNudgeMessage(requestMate, nudge); } private void validateNudgeCondition(Mate requestMate, Mate nudgedMate) { diff --git a/backend/src/main/java/com/ody/notification/service/NotificationService.java b/backend/src/main/java/com/ody/notification/service/NotificationService.java index 72ba587ff..bc7ea8acb 100644 --- a/backend/src/main/java/com/ody/notification/service/NotificationService.java +++ b/backend/src/main/java/com/ody/notification/service/NotificationService.java @@ -68,8 +68,8 @@ public void subscribeTopic(DeviceToken deviceToken, FcmTopic fcmTopic){ } @Transactional - public void sendNudgeMessage(Mate requestMate, Mate nudgedMate) { - Notification nudgeNotification = notificationRepository.save(new Nudge(nudgedMate).toNotification()); + public void sendNudgeMessage(Mate requestMate, Nudge nudge) { + Notification nudgeNotification = notificationRepository.save(nudge.toNotification()); NudgeEvent nudgeEvent = new NudgeEvent(this, requestMate, nudgeNotification); fcmEventPublisher.publishWithTransaction(nudgeEvent); } diff --git a/backend/src/test/java/com/ody/notification/service/NotificationServiceTest.java b/backend/src/test/java/com/ody/notification/service/NotificationServiceTest.java index c7f0fe7d5..a142908ed 100644 --- a/backend/src/test/java/com/ody/notification/service/NotificationServiceTest.java +++ b/backend/src/test/java/com/ody/notification/service/NotificationServiceTest.java @@ -12,8 +12,8 @@ import com.ody.notification.domain.Notification; import com.ody.notification.domain.NotificationStatus; import com.ody.notification.domain.NotificationType; +import com.ody.notification.domain.types.Nudge; import com.ody.notification.dto.response.NotiLogFindResponse; -import com.ody.notification.dto.response.NotiLogFindResponses; import com.ody.notification.repository.NotificationRepository; import com.ody.notification.service.event.NudgeEvent; import com.ody.notification.service.event.UnSubscribeEvent; @@ -21,7 +21,6 @@ import java.time.Instant; import java.time.LocalDateTime; import java.util.List; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.mockito.BDDMockito; @@ -88,8 +87,9 @@ void sendSendNudgeMessageMessage() { Meeting odyMeeting = fixtureGenerator.generateMeeting(); Mate requestMate = fixtureGenerator.generateMate(odyMeeting); Mate nudgedMate = fixtureGenerator.generateMate(odyMeeting); + Nudge nudge = new Nudge(nudgedMate); - notificationService.sendNudgeMessage(requestMate, nudgedMate); + notificationService.sendNudgeMessage(requestMate, nudge); assertThat(applicationEvents.stream(NudgeEvent.class)) .hasSize(1);