Skip to content

Commit 0426ec9

Browse files
feat: 준비과정 생성/수정시 TaskScheduler의 스케줄 업데이트되게 수정
1 parent 3c644e0 commit 0426ec9

4 files changed

Lines changed: 4 additions & 9 deletions

File tree

ontime-back/src/main/java/devkor/ontime_back/entity/NotificationSchedule.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,4 @@ public void markAsUnsent() {
5252
public void disconnectSchedule() {
5353
this.schedule = null;
5454
}
55-
56-
public void changeNotificationTime(LocalDateTime notificationTime) {
57-
this.notificationTime = notificationTime;
58-
}
5955
}

ontime-back/src/main/java/devkor/ontime_back/service/NotificationService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public void sendReminder(NotificationSchedule notificationSchedule, String messa
6868

6969
if (userId != null) {
7070
UserSetting userSetting = userSettingRepository.findByUserId(userId)
71-
.orElseThrow(() -> new IllegalArgumentException("No UserSetting found in schedule's user"));// Repository 메서드 가정
71+
.orElseThrow(() -> new IllegalArgumentException("No UserSetting found in schedule's user"));
72+
log.debug("사용자 알림 전송 설정 여부: " + userSetting.getIsNotificationsEnabled());
7273

7374
if (Boolean.TRUE.equals(userSetting.getIsNotificationsEnabled())) {
7475
sendNotificationToUser(notificationSchedule.getSchedule(), message);

ontime-back/src/main/java/devkor/ontime_back/service/PreparationScheduleService.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ protected void handlePreparationSchedules(Long userId, UUID scheduleId, List<Pre
9999
LocalDateTime notificationTime = scheduleService.getNotificationTime(schedule, schedule.getUser());
100100
log.info("Notification Time(변경된): " + notificationTime);
101101

102-
notification.changeNotificationTime(notificationTime);
103-
104-
notificationScheduleRepository.save(notification);
102+
scheduleService.updateAndRescheduleNotification(notificationTime, notification);
105103
}
106104
}

ontime-back/src/main/java/devkor/ontime_back/service/ScheduleService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void modifySchedule(Long userId, UUID scheduleId, ScheduleModDto schedule
107107
updateAndRescheduleNotification(newNotificationTime, notification);
108108
}
109109

110-
private void updateAndRescheduleNotification(LocalDateTime newNotificationTime, NotificationSchedule notification) {
110+
public void updateAndRescheduleNotification(LocalDateTime newNotificationTime, NotificationSchedule notification) {
111111
if(newNotificationTime == notification.getNotificationTime()) return;
112112

113113
notificationService.cancelScheduledNotification(notification.getId());

0 commit comments

Comments
 (0)