From 9a086a3c922a1f8382ef60af20a900467a770c72 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 17 Jul 2025 14:30:37 +0800 Subject: [PATCH] perf: Config workspace api --- backend/apps/system/api/workspace.py | 3 ++- backend/apps/system/schemas/system_schema.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/apps/system/api/workspace.py b/backend/apps/system/api/workspace.py index fb8a1fb6..096a4038 100644 --- a/backend/apps/system/api/workspace.py +++ b/backend/apps/system/api/workspace.py @@ -109,12 +109,13 @@ async def create(session: SessionDep, current_user: CurrentUser, creator: UserWs if not current_user.isAdmin and current_user.weight == 0: raise HTTPException("no permission to execute") oid: int = creator.oid if current_user.isAdmin else current_user.oid + weight = creator.weight if (current_user.isAdmin and creator.weight) else 0 # 判断uid_list以及oid合法性 db_model_list = [ UserWsModel.model_validate({ "oid": oid, "uid": uid, - "weight": creator.weight + "weight": weight }) for uid in creator.uid_list ] diff --git a/backend/apps/system/schemas/system_schema.py b/backend/apps/system/schemas/system_schema.py index feaa3c83..30592c31 100644 --- a/backend/apps/system/schemas/system_schema.py +++ b/backend/apps/system/schemas/system_schema.py @@ -50,7 +50,7 @@ class UserWsBase(BaseModel): uid_list: list[int] oid: Optional[int] = None class UserWsDTO(UserWsBase): - weight: int = 0 + weight: Optional[int] = 0 class UserWsEditor(BaseModel): uid: int