Files
book_library_server/fastapi_book_server/app/serializers/author.py
2021-11-14 10:38:47 +03:00

49 lines
759 B
Python

from typing import Optional
from datetime import date
from pydantic import BaseModel
class Author(BaseModel):
id: int
first_name: str
last_name: str
middle_name: Optional[str]
class CreateAuthor(BaseModel):
source: int
remote_id: int
first_name: str
last_name: str
middle_name: Optional[str]
class UpdateAuthor(BaseModel):
first_name: str
last_name: str
middle_name: Optional[str]
class AuthorBook(BaseModel):
id: int
title: str
lang: str
file_type: str
class Translation(BaseModel):
translator: Author
position: int
class TranslatedBook(BaseModel):
id: int
title: str
lang: str
file_type: str
authors: list[Author]
translations: list[Translation]