diff --git a/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java b/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java index 22a2480..b3a1fa5 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java @@ -189,12 +189,12 @@ * @param title 追加するべきtodoのタイトル * @return 新しいtodoのid */ - public int createTodo(String accountId, int bookId, int year, int month, int day, String title, String token){ + public Todo createTodo(String accountId, int bookId, int year, int month, int day, String title, String token){ if(!accountManager.checkToken(accountId, token)){ - return -1; + return null; } if(!bookManager.getBooks(accountId, token).containsKey(bookId)){ - return -1; + return null; } if(!todos.containsKey(accountId)){ todos.put(accountId, new HashMap<>()); @@ -221,7 +221,7 @@ Todo newTodo = new Todo(title, false, year, month, day, newTodoId); todos.get(accountId).get(bookId).get(year).get(month).get(day).put(newTodoId, newTodo); nextTodoId.put(accountBook, newTodoId + 1); - return newTodoId; + return newTodo; } /** @@ -233,7 +233,7 @@ * @param title 追加したいtodoのタイトル * @return 新しいtodoのid */ - public int createTodo(String accountId, int bookId, String yearMonthDay, String title, String token){ + public Todo createTodo(String accountId, int bookId, String yearMonthDay, String title, String token){ String[] yearMonthDays = yearMonthDay.split("-"); int year = Integer.parseInt(yearMonthDays[0]); int month = Integer.parseInt(yearMonthDays[1]);