mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 07:05:36 +01:00
Add remote_id
This commit is contained in:
@@ -24,8 +24,9 @@ class Book(BaseModel):
|
||||
pass
|
||||
|
||||
|
||||
class BookWithSource(Book):
|
||||
class RemoteBook(Book):
|
||||
source: BookSource
|
||||
remote_id: int
|
||||
|
||||
|
||||
class CreateBook(BaseModel):
|
||||
|
||||
@@ -7,7 +7,7 @@ from fastapi_pagination.ext.ormar import paginate
|
||||
from app.utils.pagination import CustomPage
|
||||
|
||||
from app.models import Book as BookDB, Author as AuthorDB, AuthorAnnotation as AuthorAnnotationDB
|
||||
from app.serializers.book import Book, BookWithSource, CreateBook, UpdateBook, CreateRemoteBook
|
||||
from app.serializers.book import Book, RemoteBook, CreateBook, UpdateBook, CreateRemoteBook
|
||||
from app.services.book import BookTGRMSearchService, BookCreator
|
||||
from app.depends import check_token
|
||||
|
||||
@@ -19,7 +19,7 @@ book_router = APIRouter(
|
||||
)
|
||||
|
||||
|
||||
@book_router.get("/", response_model=CustomPage[BookWithSource], dependencies=[Depends(Params)])
|
||||
@book_router.get("/", response_model=CustomPage[RemoteBook], dependencies=[Depends(Params)])
|
||||
async def get_books():
|
||||
return await paginate(
|
||||
BookDB.objects.select_related(["source", "authors"])
|
||||
|
||||
Reference in New Issue
Block a user