From f5c228570858f06140052b50dce89d24b217f0ff Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 14:41:59 +0000 Subject: [PATCH] Update code in endpoints/bookes.get.py --- endpoints/bookes.get.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 endpoints/bookes.get.py diff --git a/endpoints/bookes.get.py b/endpoints/bookes.get.py new file mode 100644 index 0000000..6a01cf9 --- /dev/null +++ b/endpoints/bookes.get.py @@ -0,0 +1,17 @@ +# Entity: Book + +from fastapi import APIRouter, Depends, HTTPException, status +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", response_model=List[BookSchema], status_code=200) +async def get_books(db: Session = Depends(get_db)): + """Get all books""" + books = get_all_books(db) + return books \ No newline at end of file