This commit is contained in:
@@ -34,7 +34,7 @@ from src.apis.version1.tysc import (
|
||||
from src.core.security import get_current_user_from_token
|
||||
|
||||
from src.apis.version1.user import assignment, permission, profile, token
|
||||
from src.apis.version1.bookshelf import article
|
||||
from src.apis.version1.bookshelf import article, publisher, book, author, articleauthor, bookauthor
|
||||
|
||||
api_router = APIRouter(prefix="/api")
|
||||
api_router.include_router(
|
||||
@@ -169,6 +169,36 @@ api_router.include_router(
|
||||
tags=["bookshelf"],
|
||||
dependencies=[Depends(get_current_user_from_token)],
|
||||
)
|
||||
api_router.include_router(
|
||||
publisher.router,
|
||||
prefix="/bookshelf",
|
||||
tags=["bookshelf"],
|
||||
dependencies=[Depends(get_current_user_from_token)],
|
||||
)
|
||||
api_router.include_router(
|
||||
book.router,
|
||||
prefix="/bookshelf",
|
||||
tags=["bookshelf"],
|
||||
dependencies=[Depends(get_current_user_from_token)],
|
||||
)
|
||||
api_router.include_router(
|
||||
author.router,
|
||||
prefix="/bookshelf",
|
||||
tags=["bookshelf"],
|
||||
dependencies=[Depends(get_current_user_from_token)],
|
||||
)
|
||||
api_router.include_router(
|
||||
articleauthor.router,
|
||||
prefix="/bookshelf",
|
||||
tags=["bookshelf"],
|
||||
dependencies=[Depends(get_current_user_from_token)],
|
||||
)
|
||||
api_router.include_router(
|
||||
bookauthor.router,
|
||||
prefix="/bookshelf",
|
||||
tags=["bookshelf"],
|
||||
dependencies=[Depends(get_current_user_from_token)],
|
||||
)
|
||||
api_router.include_router(
|
||||
profile.router,
|
||||
prefix="/user",
|
||||
|
||||
@@ -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