diff --git a/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java b/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java index 6e8982c..27ef254 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java @@ -6,6 +6,7 @@ import org.ntlab.citrusserver.entities.Book; import org.ntlab.citrusserver.repositories.AccountManager; import org.ntlab.citrusserver.repositories.BookManager; +import org.ntlab.citrusserver.repositories.FavoriteManager; import org.ntlab.citrusserver.repositories.TodoManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -22,12 +23,14 @@ private final BookManager bookManager; private final AccountManager accountManager; private final TodoManager todoManager; + private final FavoriteManager favoriteManager; @Autowired // スプリングブートにいうサイン - public BooksRest(BookManager bm, AccountManager ac, TodoManager tm){//public クラス名()がコンストラクタ + public BooksRest(BookManager bm, AccountManager ac, TodoManager tm, FavoriteManager fm){//public クラス名()がコンストラクタ bookManager = bm; accountManager = ac; todoManager = tm; + favoriteManager = fm; } @@ -77,6 +80,7 @@ accountCheck(account_id); tokenCheck(account_id, token); todoManager.deleteAllTodosByBookId(account_id, book_id);//削除時、Todoも消す + favoriteManager.removeFavoriteByBookID(account_id, book_id);//削除時、Favoriteも消す bookManager.deleteBook(account_id, book_id); return "success"; }