mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
Add genres api
This commit is contained in:
42
fastapi_book_server/app/serializers/genre.py
Normal file
42
fastapi_book_server/app/serializers/genre.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from pydantic import BaseModel, constr
|
||||
|
||||
from app.serializers.orjson_config import ORJSONConfig
|
||||
|
||||
|
||||
class GenreSource(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
|
||||
|
||||
class Genre(BaseModel):
|
||||
id: int
|
||||
source: GenreSource
|
||||
remote_id: int
|
||||
code: str
|
||||
description: str
|
||||
meta: str
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
|
||||
|
||||
class CreateGenre(BaseModel):
|
||||
source: int
|
||||
remote_id: int
|
||||
code: constr(max_length=45) # type: ignore
|
||||
description: constr(max_length=99) # type: ignore
|
||||
meta: constr(max_length=45) # type: ignore
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
|
||||
|
||||
class UpdateGenre(BaseModel):
|
||||
source: int
|
||||
remote_id: int
|
||||
code: constr(max_length=45) # type: ignore
|
||||
description: constr(max_length=99) # type: ignore
|
||||
meta: constr(max_length=45) # type: ignore
|
||||
|
||||
class Config(ORJSONConfig):
|
||||
pass
|
||||
Reference in New Issue
Block a user