From b1890397ae9e21f43eed5372ced4ea82bfc619ba Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 02:46:55 +0100 Subject: [PATCH] Update code in endpoints/books.get.py --- endpoints/books.get.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 endpoints/books.get.py diff --git a/endpoints/books.get.py b/endpoints/books.get.py new file mode 100644 index 0000000..7067ebc --- /dev/null +++ b/endpoints/books.get.py @@ -0,0 +1,18 @@ +# Entity: Book + +from fastapi import APIRouter, Depends +from sqlalchemy.orm import Session +from typing import List +from core.database import get_db +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