Skip to content

Commit 9a086a3

Browse files
perf: Config workspace api
1 parent 8a83921 commit 9a086a3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

backend/apps/system/api/workspace.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ async def create(session: SessionDep, current_user: CurrentUser, creator: UserWs
109109
if not current_user.isAdmin and current_user.weight == 0:
110110
raise HTTPException("no permission to execute")
111111
oid: int = creator.oid if current_user.isAdmin else current_user.oid
112+
weight = creator.weight if (current_user.isAdmin and creator.weight) else 0
112113
# 判断uid_list以及oid合法性
113114
db_model_list = [
114115
UserWsModel.model_validate({
115116
"oid": oid,
116117
"uid": uid,
117-
"weight": creator.weight
118+
"weight": weight
118119
})
119120
for uid in creator.uid_list
120121
]

backend/apps/system/schemas/system_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class UserWsBase(BaseModel):
5050
uid_list: list[int]
5151
oid: Optional[int] = None
5252
class UserWsDTO(UserWsBase):
53-
weight: int = 0
53+
weight: Optional[int] = 0
5454

5555
class UserWsEditor(BaseModel):
5656
uid: int

0 commit comments

Comments
 (0)