Update code in endpoints/bookes.get.py

This commit is contained in:
Backend IM Bot 2025-03-28 14:41:59 +00:00
parent 2018751977
commit f5c2285708

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

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