diff --git a/src/main/java/org/ntlab/citrusserver/resources/TodoRest.java b/src/main/java/org/ntlab/citrusserver/resources/TodoRest.java index 713bcc8..22c1f7d 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/TodoRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/TodoRest.java @@ -39,7 +39,7 @@ @GET @Produces(MediaType.APPLICATION_JSON) public HashMap>>> getAllTodos(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id, @QueryParam("token") String token) { - if (accountManager.checkToken(account_id, token) == true) { + if (accountManager.checkToken(account_id, token)) { return todoManager.getAllTodos(account_id, book_id); } return null; @@ -50,7 +50,7 @@ @GET @Produces(MediaType.APPLICATION_JSON) public HashMap> getTodosByMonth(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id, @PathParam("year") Integer year, @PathParam("month") Integer month, @QueryParam("token") String token) { - if (accountManager.checkToken(account_id, token) == true) { + if (accountManager.checkToken(account_id, token)) { return todoManager.getTodosByMonth(account_id, book_id, year, month); } return null; @@ -61,7 +61,7 @@ @GET @Produces(MediaType.APPLICATION_JSON) public HashMap getTodosByDay(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id, @PathParam("year") Integer year, @PathParam("month") Integer month, @PathParam("day") Integer day, @QueryParam("token") String token) { - if (accountManager.checkToken(account_id, token) == true) { + if (accountManager.checkToken(account_id, token)) { return todoManager.getTodosByDay(account_id, book_id, year, month, day); } return null; @@ -72,7 +72,7 @@ @GET @Produces(MediaType.APPLICATION_JSON) public Todo getTodoById(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id, @PathParam("year") Integer year, @PathParam("month") Integer month, @PathParam("day") Integer day, @PathParam("todo_id") Integer todo_id, @QueryParam("token") String token) { - if (accountManager.checkToken(account_id, token) == true) { + if (accountManager.checkToken(account_id, token)) { Todo todo = todoManager.getTodoById(account_id, book_id, year, month, day, todo_id); return todo; } @@ -86,7 +86,7 @@ @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) public Todo createTodo(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id, @PathParam("year") Integer year, @PathParam("month") Integer month, @PathParam("day") Integer day, @FormParam("title") String title, @FormParam("token") String token) { - if (accountManager.checkToken(account_id, token) == true) { + if (accountManager.checkToken(account_id, token)) { return todoManager.createTodo(account_id, book_id, year, month, day, title); } return null; @@ -99,9 +99,9 @@ @Path("/{account_id}/books/{book_id}/todos/{year}/{month}/{day}/{todo_id}/check") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public void setCheck(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id, @PathParam("year") Integer year, @PathParam("month") Integer month, @PathParam("day") Integer day, @PathParam("todo_id") Integer todo_id, @FormParam("check") boolean check, @FormParam("token") String token) { - if (accountManager.checkToken(account_id, token) == true) { + if (accountManager.checkToken(account_id, token)) { if (todoManager.setCheck(account_id, book_id, year, month, day, todo_id, check) == -1) { - var response = Response.status(Response.Status.BAD_REQUEST).entity("消去失敗"); + var response = Response.status(Response.Status.BAD_REQUEST).entity("変更失敗"); throw new WebApplicationException(response.build()); } }else{ @@ -127,13 +127,13 @@ @Path("/{account_id}/books/{book_id}/todos/{year}/{month}/{day}/{todo_id}") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public void deleteTodoById(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id, @PathParam("year") Integer year, @PathParam("month") Integer month, @PathParam("day") Integer day, @PathParam("todo_id") Integer todo_id, @QueryParam("token") String token) { - if (accountManager.checkToken(account_id, token) == true) { - if (todoManager.deleteTodoById(account_id, book_id, year, month, day, todo_id) == 1) { + if (accountManager.checkToken(account_id, token)) { + if (todoManager.deleteTodoById(account_id, book_id, year, month, day, todo_id) == -1) { var response = Response.status(Response.Status.BAD_REQUEST).entity("消去失敗"); throw new WebApplicationException(response.build()); } }else { - var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗」"); + var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗"); throw new WebApplicationException(response.build()); } }