53 lines
936 B
Python
53 lines
936 B
Python
from typing import List, Optional
|
|
|
|
from schemas.base import BaseSchema, OkMessageSchema
|
|
from schemas.payrate import PayRateSchema
|
|
from schemas.position import PositionSchema
|
|
from schemas.role import RoleSchema
|
|
|
|
|
|
# region Entities
|
|
|
|
|
|
class BaseUser(BaseSchema):
|
|
id: int
|
|
telegram_id: int
|
|
phone_number: str | None = None
|
|
first_name: str
|
|
second_name: str
|
|
comment: str
|
|
|
|
is_admin: bool
|
|
is_blocked: bool
|
|
is_deleted: bool
|
|
role_key: str
|
|
pay_rate: Optional[PayRateSchema] = None
|
|
|
|
|
|
class UserSchema(BaseUser):
|
|
role: RoleSchema
|
|
position: Optional[PositionSchema] = None
|
|
|
|
|
|
class UserUpdate(BaseUser):
|
|
position_key: Optional[str] = None
|
|
|
|
|
|
# endregion
|
|
|
|
# region Requests
|
|
class UpdateUserRequest(BaseSchema):
|
|
data: UserUpdate
|
|
|
|
|
|
# endregion
|
|
|
|
# region Responses
|
|
class GetAllUsersResponse(BaseSchema):
|
|
users: List[UserSchema]
|
|
|
|
|
|
class UpdateUserResponse(OkMessageSchema):
|
|
pass
|
|
# endregion
|