From c71c91de07996960268e0485ae6121db933bc1b7 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 11:49:02 +0000 Subject: [PATCH] feat: Update endpoint books --- endpoints/books.post.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/endpoints/books.post.py b/endpoints/books.post.py index b0b417f..c626c72 100644 --- a/endpoints/books.post.py +++ b/endpoints/books.post.py @@ -1,17 +1,15 @@ -# 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("/books", status_code=201, response_model=BookSchema) -async def add_book( - book: BookCreate, - db: Session = Depends(get_db) -): +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("/books", status_code=201, response_model=BookSchema) +async def add_book( + book: BookCreate, + db: Session = Depends(get_db) +): return create_book(db=db, book=book) \ No newline at end of file