Files
kontor/kontor-api/src/apis/version1/bookshelf/bookauthor.py
T
2026-08-14 16:39:46 +02:00

20 lines
611 B
Python

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