diff --git a/src/main/java/yerong/wedle/calendar/service/CalendarEventService.java b/src/main/java/yerong/wedle/calendar/service/CalendarEventService.java index 4ca8ead..04e5a00 100644 --- a/src/main/java/yerong/wedle/calendar/service/CalendarEventService.java +++ b/src/main/java/yerong/wedle/calendar/service/CalendarEventService.java @@ -46,8 +46,13 @@ public List convertToDto(CalendarEvent calendarEvent) { .orElseThrow(MemberNotFoundException::new); - Notification notification = notificationRepository.findByEventAndMember(calendarEvent, member).orElseThrow(NotificationNotFoundException::new);; - boolean notificationActive = notification != null && notification.isActive(); + Notification notification = notificationRepository.findByEventAndMember(calendarEvent, member); + boolean notificationActive; + if(notification != null) { + notificationActive = notification.isActive(); + } else { + notificationActive = false; + } Long notificationId = notification != null ? notification.getNotificationId() : null; if (endDate == null) { diff --git a/src/main/java/yerong/wedle/notification/repository/NotificationRepository.java b/src/main/java/yerong/wedle/notification/repository/NotificationRepository.java index 3c22c9c..cec8d66 100644 --- a/src/main/java/yerong/wedle/notification/repository/NotificationRepository.java +++ b/src/main/java/yerong/wedle/notification/repository/NotificationRepository.java @@ -13,7 +13,7 @@ public interface NotificationRepository extends JpaRepository findByNotificationDate(LocalDate notification); - Optional findByEventAndMember(CalendarEvent calendarEvent, Member member); + Notification findByEventAndMember(CalendarEvent calendarEvent, Member member); List findByMember(Member member); }