feat: nested department sections, attaching department sections in the user editor
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user