This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from src.db.models.bookshelf import ArticleAuthor
|
||||
from src.db.session import SessionDep
|
||||
from src.schema.bookshelf.articleauthor import ArticleAuthorResponse, to_response
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/articleauthors", response_model=List[ArticleAuthorResponse])
|
||||
def get_all_artists(db: SessionDep) -> List[ArticleAuthorResponse]:
|
||||
results: List[ArticleAuthorResponse] = []
|
||||
articleauthors = db.query(ArticleAuthor).all()
|
||||
for articleauthor in articleauthors:
|
||||
response = to_response(articleauthor)
|
||||
results.append(response)
|
||||
return results
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from src.db.models.bookshelf import Author
|
||||
from src.db.session import SessionDep
|
||||
from src.schema.bookshelf.author import AuthorResponse, to_response
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/authors", response_model=List[AuthorResponse])
|
||||
def get_all_artists(db: SessionDep) -> List[AuthorResponse]:
|
||||
results: List[AuthorResponse] = []
|
||||
authors = db.query(Author).all()
|
||||
for author in authors:
|
||||
response = to_response(author)
|
||||
results.append(response)
|
||||
return results
|
||||
@@ -0,0 +1,19 @@
|
||||
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
|
||||
@@ -0,0 +1,19 @@
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from src.db.models.bookshelf import BookAuthor
|
||||
from src.db.session import SessionDep
|
||||
from src.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
|
||||
@@ -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