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}
|
||||
|
||||
@@ -113,6 +113,11 @@ async def lifespan(app: FastAPI):
|
||||
if discovered:
|
||||
logger.info("Auto-discovered projects: %s", discovered)
|
||||
|
||||
# v3.0: 自动发现 sanguo_projects 正式项目
|
||||
sanguo_discovered = registry.discover_sanguo_projects()
|
||||
if sanguo_discovered:
|
||||
logger.info("Auto-discovered sanguo projects: %s", sanguo_discovered)
|
||||
|
||||
daemon_config = config.get("daemon", {})
|
||||
tick_interval = daemon_config.get("tick_interval", 30)
|
||||
max_dispatch = daemon_config.get("max_dispatch_per_tick", 3)
|
||||
|
||||
Reference in New Issue
Block a user