Update code in endpoints/bookes.get.py
This commit is contained in:
parent
2018751977
commit
f5c2285708
17
endpoints/bookes.get.py
Normal file
17
endpoints/bookes.get.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user