package org.ntlab.citrusserver.resources;
import jakarta.ws.rs.GET;
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 BookRest {//BookRestはクラス
private final BookManager bookManeger;
@Autowired //スプリングブートにいうサイン
public BookRest(bookManeger bm){ //public クラス名()がコンストラクタ
bookManeger = bm; //bookManagerって変数?
}
@Path("/{account_id}/books/{book_id}")
/// 本の情報を取得
@GET
@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;
}
}