Skip to content

Commit

Permalink
refactor: 넛지 알림 시그니처 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
coli-geonwoo committed Dec 28, 2024
1 parent 2d4decd commit f10288e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion backend/src/main/java/com/ody/mate/service/MateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
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;
import com.ody.route.service.RouteService;
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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f10288e

Please sign in to comment.