diff --git a/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java b/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java index 19bac65..57e5a44 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/BooksRest.java @@ -4,14 +4,32 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; +import org.ntlab.citrusserver.entities.Book; +import org.ntlab.citrusserver.repositories.BookManager; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; + + @Path("/accounts") @Component -public class BooksRest { + + +public class BookRest {//BookRestはクラス + + private final BookManager bookManeger; + @Autowired //スプリングブートにいうサイン + public BookRest(bookManeger bm){ //public クラス名()がコンストラクタ + bookManeger = bm; //bookManagerって変数? + } + + @Path("/{account_id}/books/{book_id}") + +/// 本の情報を取得 @GET - @Produces(MediaType.TEXT_PLAIN)//returnの形をどうするか - public String getAccounts() { - return null; + @Produces(MediaType.APPLICATION_JSON) //returnの形をどうするか + public Book getBook(@PathParam("account_id") String account_id, @PathParam("book_id") Integer book_id){ + Book book = bookManeger.getBook(account_id, book_id); + return book; } } \ No newline at end of file