51 lines
		
	
	
		
			849 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			849 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from typing import List, Optional
 | 
						|
 | 
						|
from schemas.base import BaseSchema, OkMessageSchema
 | 
						|
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
 | 
						|
 | 
						|
 | 
						|
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
 |