Skip to content

Commit

Permalink
Merge pull request #155 from UnivApp/feature/notification-refactor7
Browse files Browse the repository at this point in the history
refactor: 알림 구현 리팩토링
  • Loading branch information
nyeroni authored Oct 28, 2024
2 parents 0f646eb + c824755 commit 4e500f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ public List<CalendarEventResponse> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface NotificationRepository extends JpaRepository<Notification, Long

List<Notification> findByNotificationDate(LocalDate notification);

Optional<Notification> findByEventAndMember(CalendarEvent calendarEvent, Member member);
Notification findByEventAndMember(CalendarEvent calendarEvent, Member member);

List<Notification> findByMember(Member member);
}

0 comments on commit 4e500f3

Please sign in to comment.