auto-sync: 2026-05-20 20:36:09
This commit is contained in:
@@ -54,3 +54,29 @@ async def archive_project(project_id: str):
|
||||
if not reg.archive_project(project_id):
|
||||
raise HTTPException(404, f"Project not found: {project_id}")
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@router.delete("/{project_id}")
|
||||
async def delete_project(project_id: str):
|
||||
"""逻辑删除项目(status→deleted)"""
|
||||
reg = _registry()
|
||||
# 检查项目存在
|
||||
info = reg.get_project(project_id)
|
||||
if not info:
|
||||
raise HTTPException(404, f"Project not found: {project_id}")
|
||||
if not reg.delete_project(project_id):
|
||||
raise HTTPException(500, "Delete failed")
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@router.patch("/{project_id}")
|
||||
async def update_project(project_id: str, body: Dict[str, Any]):
|
||||
"""更新项目元数据(name/description 等)"""
|
||||
reg = _registry()
|
||||
allowed = {"name", "description", "status"}
|
||||
updates = {k: v for k, v in body.items() if k in allowed}
|
||||
if not updates:
|
||||
return {"ok": True}
|
||||
if not reg.update_project(project_id, **updates):
|
||||
raise HTTPException(404, f"Project not found: {project_id}")
|
||||
return {"ok": True}
|
||||
|
||||
Reference in New Issue
Block a user