This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from src.db.models.bookshelf import BookshelfPublisher
|
||||
from src.db.session import SessionDep
|
||||
from src.schema.bookshelf.publisher import PublisherResponse, to_response
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/publishers", response_model=List[PublisherResponse])
|
||||
def get_all_artists(db: SessionDep) -> List[PublisherResponse]:
|
||||
results: List[PublisherResponse] = []
|
||||
publishers = db.query(BookshelfPublisher).all()
|
||||
for publisher in publishers:
|
||||
response = to_response(publisher)
|
||||
results.append(response)
|
||||
return results
|
||||
Reference in New Issue
Block a user