Update code in endpoints/book.get.py

This commit is contained in:
Backend IM Bot 2025-03-28 12:10:06 +01:00
parent d4a6a7f3f9
commit 6b00e560eb

17
endpoints/book.get.py Normal file
View File

@ -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