@@ -45,11 +45,11 @@ async def activate_workspace(request: v1_models.ActivateWorkspaceRequest, status
4545 try :
4646 await wscrud .activate_workspace (request .name )
4747 except crud .WorkspaceAlreadyActiveError :
48- return HTTPException (status_code = 409 , detail = "Workspace already active" )
48+ raise HTTPException (status_code = 409 , detail = "Workspace already active" )
4949 except crud .WorkspaceDoesNotExistError :
50- return HTTPException (status_code = 404 , detail = "Workspace does not exist" )
50+ raise HTTPException (status_code = 404 , detail = "Workspace does not exist" )
5151 except Exception :
52- return HTTPException (status_code = 500 , detail = "Internal server error" )
52+ raise HTTPException (status_code = 500 , detail = "Internal server error" )
5353
5454 return Response (status_code = 204 )
5555
@@ -79,8 +79,16 @@ async def create_workspace(request: v1_models.CreateWorkspaceRequest) -> v1_mode
7979 "/workspaces/{workspace_name}" ,
8080 tags = ["Workspaces" ],
8181 generate_unique_id_function = uniq_name ,
82- status_code = 204 ,
8382)
8483async def delete_workspace (workspace_name : str ):
8584 """Delete a workspace by name."""
86- raise NotImplementedError
85+ try :
86+ _ = await wscrud .soft_delete_workspace (workspace_name )
87+ except crud .WorkspaceDoesNotExistError :
88+ raise HTTPException (status_code = 404 , detail = "Workspace does not exist" )
89+ except crud .WorkspaceCrudError as e :
90+ raise HTTPException (status_code = 400 , detail = str (e ))
91+ except Exception :
92+ raise HTTPException (status_code = 500 , detail = "Internal server error" )
93+
94+ return Response (status_code = 204 )
0 commit comments