tokenが違う時の処理を具体化しました
1 parent 9331041 commit 1a3ab38e496b1ea8d23fdf55a2def393bbb1163f
Kazuki Shiomura authored on 16 May
Showing 1 changed file
View
41
src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java
// public ArrayList<Integer> getScheduleAll(@PathParam("account_id") String accountId, @QueryParam("token") String token){
// if(accountManager.checkToken(accountId,token)) {
// return scheduleManager.getScheduleAll(accountId);
// }
// return null;
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
 
// @Path("/{account_id}/schedule/{year}")
// @GET//登録されたスケジュールのidを年単位で返す
// public ArrayList<Integer> getScheduleYear(@PathParam("account_id") String accountId, @PathParam("year") Integer year,@QueryParam("token") String token){
// if(accountManager.checkToken(accountId,token)) {
// return scheduleManager.getScheduleYear(accountId,year);
// }
// return null;
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
 
// @Path("/{account_id}/schedule/{year}/{month}")
// @GET//登録されたスケジュールのidを月単位で返す
// @QueryParam("token") String token){
// if(accountManager.checkToken(accountId,token)) {
// return scheduleManager.getScheduleMonth(accountId,year,month);
// }
// return null;
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
 
// @Path("/{account_id}/schedule/{year}/{month}/{day}")
// @GET//登録されたスケジュールのidを日ごとで返す
// @PathParam("day") Integer day,@QueryParam("token") String token){
// if(accountManager.checkToken(accountId,token)) {
// return scheduleManager.getScheduleYear(accountId,year,month,day);
// }
// return null;
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
 
@Path("/{account_id}/schedule/{year}/{month}/{day}")
@POST//スケジュールの新規作成
@PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) {
if(accountManager.checkToken(accountId,token)) {
Schedule schedule = scheduleManager.getScheduleId(accountId, year, month, day, scheduleId);
return schedule;
}else {
var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
throw new WebApplicationException(response.build());
}
var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
throw new WebApplicationException(response.build());
}
 
// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}")
// @DELETE//特定のスケジュールを削除する
// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) {
// if(accountManager.checkToken(accountId,token)) {
// scheduleManager.deleteSchedule(accountId, year, month, day, scheduleId);
// return "success";
// }else {
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
// return null;
// }
 
// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/start_time")
// @PUT//スケジュールの開始時刻の新規作成・変更
// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) {
// if(accountManager.checkToken(accountId,token)) {
// scheduleManager.setScheduleStartTime(accountId, year, month, day, scheduleId);
// return "success";
// }else {
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
// return null;
// }
 
// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/end_time")
// @PUT//スケジュールの終了時刻の新規作成・変更
// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) {
// if(accountManager.checkToken(accountId,token)) {
// scheduleManager.setScheduleEndTime(accountId, year, month, day, scheduleId);
// return "success";
// }else {
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
// return null;
// }
 
// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/title")
// @PUT//スケジュールのタイトルの変更
// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) {
// if(accountManager.checkToken(accountId,token)) {
// scheduleManager.setScheduleTitle(accountId, year, month, day, scheduleId);
// return schedule;
// }else {
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
// return null;
// }
 
// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/book_id")
// @PUT//スケジュールの所属している本の新規設定・変更
// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) {
// if(accountManager.checkToken(accountId,token)) {
// scheduleManager.setSchedulesBook(accountId, year, month, day, scheduleId);//token後でつける
// return "success";
// }else {
// var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗");
// throw new WebApplicationException(response.build());
// }
// return null;
// }
}