diff --git a/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java b/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java index cd40e22..03a880c 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/TodoManager.java @@ -30,6 +30,7 @@ private final HashMap nextTodoId = new HashMap<>(); private final BookManager bookManager; + private final AccountManager accountManager; public TodoManager(AccountManager accountManager, BookManager bookManager) { this.bookManager = bookManager; @@ -39,7 +40,7 @@ Calendar c = Calendar.getInstance(); createTodo(accounts[0][0], 1, c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DATE), "ダミーtodo1"); createTodo(accounts[1][0], 1, c.get(Calendar.YEAR), c.get(Calendar.MONTH) + 1, c.get(Calendar.DATE), "ダミーtodo2"); - + this.accountManager = accountManager; } /** @@ -179,6 +180,22 @@ return todos.get(accountId).get(bookId).get(year).get(month).get(day).get(todoId); } + public void putTodoById(String accountId, int bookId, int year, int month, int day, int todoId, String token, + int newBookId, int newYear, int newMonth, int newDay, String newTitle){ + if(todos.get(accountId).containsKey(bookId)){ + if(todos.get(accountId).get(bookId).containsKey(year)){ + if(todos.get(accountId).get(bookId).get(year).containsKey(month)){ + if(todos.get(accountId).get(bookId).get(year).get(month).containsKey(day)){ + if(todos.get(accountId).get(bookId).get(year).get(month).get(day).containsKey(todoId)){ + todos.get(accountId).get(bookId).get(year).get(month).get(day).remove(todoId); + createTodo(accountId, newBookId, newYear, newMonth, newDay, newTitle); + } + } + } + } + } + } + /** *todo_idを指定してtodoを返す *