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

@@ -1,17 +1,29 @@
from typing import Optional
from schemas.base import BaseSchema, OkMessageSchema
from schemas.user import UserSchema
# region Entities
class UserDepartmentSectionSchema(BaseSchema):
user: UserSchema
is_chief: bool
class DepartmentSectionBaseSchema(BaseSchema):
name: str
department_id: int
department_id: Optional[int]
parent_department_section_id: Optional[int]
class DepartmentSectionSchema(DepartmentSectionBaseSchema):
class DepartmentSectionBriefSchema(DepartmentSectionBaseSchema):
id: int
users: list[UserSchema] = []
class DepartmentSectionSchema(DepartmentSectionBriefSchema):
users: list[UserDepartmentSectionSchema] = []
sections: list["DepartmentSectionSchema"] = []
class DepartmentBaseSchema(BaseSchema):
@@ -46,6 +58,7 @@ class UpdateDepartmentSectionRequest(BaseSchema):
class AddUserRequest(BaseSchema):
user_id: int
section_id: int
is_chief: bool
class DeleteUserRequest(BaseSchema):
@@ -73,6 +86,10 @@ class DeleteDepartmentResponse(OkMessageSchema):
pass
class GetDepartmentSectionsResponse(BaseSchema):
department_sections: list[DepartmentSectionBriefSchema]
class CreateDepartmentSectionResponse(OkMessageSchema):
pass