mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
Use orjson in serializers
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from typing import Optional
|
||||
from datetime import date
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.serializers.orjson_config import ORJSONConfig
|
||||
|
||||
|
||||
class Author(BaseModel):
|
||||
id: int
|
||||
@@ -11,6 +12,9 @@ class Author(BaseModel):
|
||||
last_name: str
|
||||
middle_name: Optional[str]
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
|
||||
|
||||
class CreateAuthor(BaseModel):
|
||||
source: int
|
||||
@@ -20,12 +24,18 @@ class CreateAuthor(BaseModel):
|
||||
last_name: str
|
||||
middle_name: Optional[str]
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
|
||||
|
||||
class UpdateAuthor(BaseModel):
|
||||
first_name: str
|
||||
last_name: str
|
||||
middle_name: Optional[str]
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
|
||||
|
||||
class AuthorBook(BaseModel):
|
||||
id: int
|
||||
@@ -33,11 +43,17 @@ class AuthorBook(BaseModel):
|
||||
lang: str
|
||||
file_type: str
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
|
||||
|
||||
class Translation(BaseModel):
|
||||
translator: Author
|
||||
position: int
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
|
||||
|
||||
class TranslatedBook(BaseModel):
|
||||
id: int
|
||||
@@ -46,3 +62,6 @@ class TranslatedBook(BaseModel):
|
||||
file_type: str
|
||||
authors: list[Author]
|
||||
translations: list[Translation]
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user