Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 80a961b

Browse files
Added deletion endpoint
1 parent 29cd093 commit 80a961b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/codegate/api/v1.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,25 @@ async def delete_workspace(workspace_name: str):
136136
return Response(status_code=204)
137137

138138

139+
@v1.delete(
140+
"/workspaces/del/{workspace_name}",
141+
tags=["Workspaces"],
142+
generate_unique_id_function=uniq_name,
143+
)
144+
async def delete_workspace_permanent(workspace_name: str):
145+
"""Delete a workspace by name."""
146+
try:
147+
_ = await wscrud.hard_delete_workspace(workspace_name)
148+
except crud.WorkspaceDoesNotExistError:
149+
raise HTTPException(status_code=404, detail="Workspace does not exist")
150+
except crud.WorkspaceCrudError as e:
151+
raise HTTPException(status_code=400, detail=str(e))
152+
except Exception:
153+
raise HTTPException(status_code=500, detail="Internal server error")
154+
155+
return Response(status_code=204)
156+
157+
139158
@v1.get(
140159
"/workspaces/{workspace_name}/alerts",
141160
tags=["Workspaces"],

0 commit comments

Comments
 (0)