This commit is contained in:
2021-12-03 23:21:37 +03:00
commit 27f35df97a
17 changed files with 501 additions and 0 deletions

22
src/app/serializers.py Normal file
View File

@@ -0,0 +1,22 @@
from pydantic import BaseModel, constr
class LanguageDetail(BaseModel):
id: int
label: constr(max_length=16) # type: ignore
code: constr(max_length=4) # type: ignore
class UserBase(BaseModel):
user_id: int
last_name: constr(max_length=64) # type: ignore
first_name: constr(max_length=64) # type: ignore
username: constr(max_length=32) # type: ignore
class UserCreateOrUpdate(BaseModel):
allowed_langs: list[str]
class UserDetail(UserCreateOrUpdate):
allowed_langs: list[LanguageDetail]