mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 07:05:36 +01:00
Add sequences to books by author and translator
This commit is contained in:
@@ -3,6 +3,8 @@ from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.serializers.sequence import Sequence
|
||||
|
||||
|
||||
class Author(BaseModel):
|
||||
id: int
|
||||
@@ -22,6 +24,7 @@ class AuthorBook(BaseModel):
|
||||
available_types: list[str]
|
||||
uploaded: date
|
||||
translators: list[Author]
|
||||
sequences: list[Sequence]
|
||||
annotation_exists: bool
|
||||
|
||||
|
||||
@@ -32,4 +35,5 @@ class TranslatedBook(BaseModel):
|
||||
file_type: str
|
||||
available_types: list[str]
|
||||
authors: list[Author]
|
||||
sequences: list[Sequence]
|
||||
annotation_exists: bool
|
||||
|
||||
@@ -87,7 +87,7 @@ async def get_author_books(
|
||||
):
|
||||
return await paginate(
|
||||
BookDB.objects.prefetch_related(["source"])
|
||||
.select_related(["annotations", "translators"])
|
||||
.select_related(["annotations", "translators", "sequences"])
|
||||
.filter(authors__id=id, lang__in=allowed_langs, is_deleted=False)
|
||||
.order_by("title")
|
||||
)
|
||||
@@ -120,7 +120,7 @@ async def get_translated_books(
|
||||
):
|
||||
return await paginate(
|
||||
BookDB.objects.prefetch_related(["source"])
|
||||
.select_related(["annotations", "authors"])
|
||||
.select_related(["annotations", "authors", "sequences"])
|
||||
.filter(
|
||||
translators__id=id,
|
||||
lang__in=allowed_langs,
|
||||
|
||||
Reference in New Issue
Block a user