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