From 972e8377b7402ed16839033266a40e78ae089bdc Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 00:36:37 +0000 Subject: [PATCH] Update code in endpoints/book.post.py --- endpoints/book.post.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 endpoints/book.post.py diff --git a/endpoints/book.post.py b/endpoints/book.post.py new file mode 100644 index 0000000..844ad4a --- /dev/null +++ b/endpoints/book.post.py @@ -0,0 +1,17 @@ +# Entity: Book + +from fastapi import APIRouter, Depends, HTTPException, status +from sqlalchemy.orm import Session +from core.database import get_db +from models.book import Book +from schemas.book import BookSchema, BookCreate +from helpers.book_helpers import create_book + +router = APIRouter() + +@router.post("/book", status_code=201, response_model=BookSchema) +async def save_book( + book: BookCreate, + db: Session = Depends(get_db) +): + return create_book(db=db, book=book) \ No newline at end of file