Add GET endpoint for books

This commit is contained in:
Backend IM Bot 2025-03-26 17:50:27 +00:00
parent 1ea8b31881
commit fcebd46543

View File

@ -9,11 +9,8 @@ from core.schemas.book import BookSchema
router = APIRouter()
@router.get("/books", response_model=List[BookSchema], status_code=status.HTTP_200_OK)
async def get_books(
db: Session = Depends(get_db),
skip: int = 0,
limit: int = 100
):
books = db.query(Book).offset(skip).limit(limit).all()
@router.get("/books", response_model=List[BookSchema], status_code=200)
async def get_books(db: Session = Depends(get_db)):
"""Get all books"""
books = db.query(Book).all()
return books