From 3409e8c774eade2dc25c394d81c175dd7b7d991c Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 2 Sep 2025 11:08:25 +0800 Subject: [PATCH] perf: Default workspace cannot be deleted --- backend/apps/system/api/workspace.py | 2 ++ frontend/src/views/system/workspace/index.vue | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/apps/system/api/workspace.py b/backend/apps/system/api/workspace.py index 0d795289..8cd05ac8 100644 --- a/backend/apps/system/api/workspace.py +++ b/backend/apps/system/api/workspace.py @@ -205,6 +205,8 @@ async def get_one(session: SessionDep, trans: Trans, id: int): @router.delete("/{id}") async def single_delete(session: SessionDep, id: int): + if id == 1: + raise HTTPException(f"Can not delete default workspace") db_model = session.get(WorkspaceModel, id) if not db_model: raise HTTPException(f"WorkspaceModel with id {id} not found") diff --git a/frontend/src/views/system/workspace/index.vue b/frontend/src/views/system/workspace/index.vue index 2363aadf..a18cec04 100644 --- a/frontend/src/views/system/workspace/index.vue +++ b/frontend/src/views/system/workspace/index.vue @@ -358,7 +358,7 @@ const handleCurrentChange = (val: number) => { {{ $t('dashboard.rename') }} -
+