feat: nested department sections, attaching department sections in the user editor

This commit is contained in:
2025-01-19 12:01:10 +04:00
parent 43a95ef75c
commit b8947ce68e
7 changed files with 198 additions and 32 deletions

View File

@@ -16,12 +16,17 @@ class PassportImageSchema(BaseSchema):
image_url: str
class UserDepartmentSectionsSchema(BaseSchema):
section_id: int
is_chief: bool
class BasicUser(BaseSchema):
telegram_id: int
phone_number: str | None = None
first_name: str
second_name: str
patronymic: str
patronymic: str = ""
comment: str
passport_data: str | None = None
@@ -51,6 +56,7 @@ class BaseUser(BasicUser):
class UserSchema(BaseUser):
role: RoleSchema
position: Optional[PositionSchema] = None
department_sections: list[UserDepartmentSectionsSchema] | None = []
class UserUpdate(BaseUser):
@@ -68,6 +74,10 @@ class UpdateUserRequest(BaseSchema):
data: UserUpdate
class UpdateUserDepartmentSectionsRequest(BaseSchema):
department_sections: list[UserDepartmentSectionsSchema]
class CreateUserRequest(BaseSchema):
data: UserCreate
@@ -83,6 +93,10 @@ class UpdateUserResponse(OkMessageSchema):
pass
class UpdateUserDepartmentSectionsResponse(OkMessageSchema):
pass
class CreateUserResponse(OkMessageSchema):
pass