From 6b00e560eb270b55a3742e7fb0fcfa4813eadb07 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 12:10:06 +0100 Subject: [PATCH] Update code in endpoints/book.get.py --- endpoints/book.get.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 endpoints/book.get.py diff --git a/endpoints/book.get.py b/endpoints/book.get.py new file mode 100644 index 0000000..f9acb2b --- /dev/null +++ b/endpoints/book.get.py @@ -0,0 +1,17 @@ +# Entity: Book + +from fastapi import APIRouter, Depends +from typing import List +from sqlalchemy.orm import Session +from models.book import Book +from schemas.book import BookSchema +from helpers.book_helpers import get_all_books + +router = APIRouter() + +@router.get("/books", status_code=200, response_model=List[BookSchema]) +async def get_books( + db: Session = Depends(get_db) +): + books = get_all_books(db) + return books \ No newline at end of file