diff --git a/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java b/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java index 760568e..7874daf 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java @@ -98,4 +98,22 @@ if(newBookId == null)newBookId = 0; schedules.get(accountId).get(year).get(month).get(day).get(scheduleId).setBookId(newBookId); } + + public void deleteSchedules(String accountId){ + schedules.remove(accountId); + } + + public void deleteScheduleBookId(String accountId, Integer bookId){ + for(int year : schedules.get(accountId).keySet()){ + for (int month : schedules.get(accountId).get(year).keySet()){ + for(int day : schedules.get(accountId).get(year).get(month).keySet()){ + for (int scheduleId : schedules.get(accountId).get(year).get(month).get(day).keySet()){ + if(schedules.get(accountId).get(year).get(month).get(day).get(scheduleId).getBookId().equals(bookId)){ + schedules.get(accountId).get(year).get(month).get(day).get(scheduleId).setBookId(0); + } + } + } + } + } + } }