diff --git a/src/main/java/org/ntlab/citrusserver/resources/AccountsRest.java b/src/main/java/org/ntlab/citrusserver/resources/AccountsRest.java index f364b5d..ed7b686 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/AccountsRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/AccountsRest.java @@ -4,6 +4,9 @@ import jakarta.ws.rs.core.Response; import org.ntlab.citrusserver.entities.Account; import org.ntlab.citrusserver.repositories.AccountManager; +import org.ntlab.citrusserver.repositories.BookManager; +import org.ntlab.citrusserver.repositories.ScheduleManager; +import org.ntlab.citrusserver.repositories.TodoManager; import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; @@ -17,9 +20,16 @@ public class AccountsRest { private final AccountManager accountManager; //finalは書き換えられない + private final BookManager bookManager; + private final TodoManager todoManager; + private final ScheduleManager scheduleManager; + @Autowired//springbootの決まり - public AccountsRest(AccountManager am) { + public AccountsRest(AccountManager am, BookManager bm, TodoManager tm, ScheduleManager sm) { accountManager = am; + bookManager = bm; + todoManager = tm; + scheduleManager = sm; } // アカウントの一覧をリストとして返す(GET) @@ -61,6 +71,9 @@ @QueryParam("password")String password) { if(accountManager.checkToken(accountId, token)) { accountManager.deleteAccount(accountId, token, password); + bookManager.deleteAllBooks(accountId); + todoManager.deleteAllTodosByAccountId(accountId); + scheduleManager.deleteSchedules(accountId); return; } //404