feat: Add GET /books endpoint
This commit is contained in:
parent
21d1694d4e
commit
ce7cc8ab3d
@ -0,0 +1,14 @@
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user