Files
kontor/kontor-api/src/apis/version1/bookshelf/book.py
T
tpeetz d5705c3a28
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
move kontor_model in kontor-api (#98)
Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de>
Reviewed-on: #98
2026-10-15 23:14:16 +00:00

20 lines
521 B
Python

from typing import List
from fastapi import APIRouter
from src.db.models.bookshelf import Book
from src.db.session import SessionDep
from src.schema.bookshelf.book import BookResponse, to_response
router = APIRouter()
@router.get("/books", response_model=List[BookResponse])
def get_all_artists(db: SessionDep) -> List[BookResponse]:
results: List[BookResponse] = []
books = db.query(Book).all()
for book in books:
response = to_response(book)
results.append(response)
return results