diff --git a/src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java b/src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java index d65ee15..7b349f0 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java @@ -84,7 +84,12 @@ @FormParam("start_time") String startTime,@FormParam("end_time") String endTime,@FormParam("book_id") Integer bookId, @FormParam("token") String token) { if(accountManager.checkToken(accountId,token)) { - return scheduleManager.addSchedule(accountId, year, month, day,title,startTime,endTime,bookId); + Schedule schedule=scheduleManager.addSchedule(accountId, year, month, day,title,startTime,endTime,bookId); + if(schedule==null){ + var response = Response.status(Response.Status.NOT_FOUND).entity("その本は存在しません"); + throw new WebApplicationException(response.build()); + } + return schedule; }else { var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗"); @@ -180,8 +185,12 @@ @PathParam("month") Integer month, @PathParam("day") Integer day, @PathParam("schedule_id") Integer scheduleId, @FormParam("token") String token, @FormParam("book_id") Integer bookId) { if(accountManager.checkToken(accountId,token)) { - scheduleManager.setSchedulesBookId(accountId, year, month, day, scheduleId, bookId); - return "success"; + int x=scheduleManager.setSchedulesBookId(accountId, year, month, day, scheduleId, bookId); + if(x==-1){ + return "その本は存在していません"; + }else{ + return "success"; + } }else { var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗"); throw new WebApplicationException(response.build());