diff --git a/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java b/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java index 295576a..6b99f95 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/ScheduleManager.java @@ -1,11 +1,13 @@ package org.ntlab.citrusserver.repositories; import org.ntlab.citrusserver.entities.Account; +import org.ntlab.citrusserver.entities.Book; import org.ntlab.citrusserver.entities.Schedule; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.util.HashMap; +import java.util.Set; @Repository public class ScheduleManager { @@ -28,16 +30,20 @@ Schedule>>>>> schedules = new HashMap<>(); - public void getScheduleAll(String accountId){ + public HashMap>>> getScheduleAll(String accountId) { + return schedules.get(accountId); } - public void getScheduleYear(String accountId, int year){ + public HashMap>> getScheduleYear(String accountId, int year){ + return schedules.get(accountId).get(year); } - public void getScheduleMonth(String accountId, int year, int month){ + public HashMap> getScheduleMonth(String accountId, int year, int month){ + return schedules.get(accountId).get(year).get(month); } - public void getScheduleDay(String accountId, int year, int month, int day){ + public HashMap getScheduleDay(String accountId, int year, int month, int day){ + return schedules.get(accountId).get(year).get(month).get(day); } public Schedule addSchedule(String accountId, int year, int month, int day, String title, String startTime, String endTime, int bookId){ @@ -70,13 +76,23 @@ return schedules.get(accountId).get(year).get(month).get(day).get(scheduleId); } - public void deleteSchedule(String accountId, int year, int month, int day, int scheduleId){} + public void deleteSchedule(String accountId, int year, int month, int day, int scheduleId){ + schedules.get(accountId).get(year).get(month).get(day).remove(scheduleId); + } - public void setScheduleStartTime(String accountId, int year, int month, int day, int scheduleId, int oldTime, int newTime){} + public void setScheduleStartTime(String accountId, int year, int month, int day, int scheduleId, String newTime){ + schedules.get(accountId).get(year).get(month).get(day).get(scheduleId).setStartTime(newTime); + } - public void setScheduleEndTime(String accountId, int year, int month, int day, int scheduleId, int oldTime, int newTime){} + public void setScheduleEndTime(String accountId, int year, int month, int day, int scheduleId, String newTime){ + schedules.get(accountId).get(year).get(month).get(day).get(scheduleId).setEndTime(newTime); + } - public void changeScheduleTitle(String accountId, int year, int month, int day, int scheduleId, String oldTitle, String newTitle){} + public void changeScheduleTitle(String accountId, int year, int month, int day, int scheduleId, String newTitle){ + schedules.get(accountId).get(year).get(month).get(day).get(scheduleId).setTitle(newTitle); + } - public void setSchedulesBookId(String accountId, int year, int month, int day, int scheduleId, int newBookId){} + public void setSchedulesBookId(String accountId, int year, int month, int day, int scheduleId, int newBookId){ + schedules.get(accountId).get(year).get(month).get(day).get(scheduleId).setScheduleId(newBookId); + } }