tech-pm-tn9qa7/endpoints/books.get.py
2025-04-11 09:35:00 +00:00

14 lines
432 B
Python

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", response_model=List[BookSchema])
async def get_all_books_endpoint(db: Session = Depends(get_db)):
books = get_all_books(db)
return books