diff --git a/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java b/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java index 99945c0..f5be882 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java @@ -14,11 +14,11 @@ @Component -public class BookRest {//BookRestはクラス +public class BooksRest {//BookRestはクラス private final BookManager bookManager; @Autowired //スプリングブートにいうサイン - public BookRest(BookManager bm){ //public クラス名()がコンストラクタ + public BooksRest(BookManager bm){ //public クラス名()がコンストラクタ bookManager = bm; } @@ -27,11 +27,11 @@ private final HashMap> books = new HashMap<>(); @Path("/{account_id}/books") - /// 本一覧を返す + /// その人の本のタイトルとかを返す @GET @Produces(MediaType.APPLICATION_JSON) - public HashMap> getBooks(){ - return bookManager.getBooks(); + public HashMap getBooks(@PathParam("account_id") String account_id){ + return bookManager.getBooks(account_id); } /// {account_id}/books/{book_id} @@ -41,20 +41,19 @@ @GET @Produces(MediaType.APPLICATION_JSON) public Book getBook(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id){ - - return ; + return bookManager.getBook(account_id, book_id); } -/// /{account_id}/books/{book_id}/favorited - @Path("/{account_id}/books/{book_id}/favorited") - - /// いいねしたアカウントを返す - @GET - @Produces(MediaType.APPLICATION_JSON) - public Book getBook(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id){ - Book book = bookManager.getBook(account_id, book_id); - return book; - } +///// /{account_id}/books/{book_id}/favorited +// @Path("/{account_id}/books/{book_id}/favorited") +// +// /// いいねしたアカウントを返す +// @GET +// @Produces(MediaType.APPLICATION_JSON) +// public Book g(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id){ +// Book book = bookManager.getBook(account_id, book_id); +// return book; +// } /// /{account_id}/books/{book_id}/title @@ -63,9 +62,8 @@ /// 本のタイトルを返す @GET @Produces(MediaType.TEXT_PLAIN) - public Book getBook(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id){ - Book book = bookManager.getBook(account_id, book_id); - return book; + public String getTitle(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id){ + return bookManager.getTitle(account_id, book_id); } /// /accounts/{account_id}/books/{book_id}/public @@ -73,10 +71,9 @@ /// 本の公開状態を返す @GET - @Produces(MediaType.APPLICATION_JSON) - public Book getBook(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id){ - Book book = bookManager.getBook(account_id, book_id); - return book; + @Produces(MediaType.TEXT_PLAIN) + public Boolean getPublicity(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id){ + return bookManager.getPublicity(account_id, book_id); }