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