auto-sync: 2026-05-18 23:26:30

This commit is contained in:
cfdaily
2026-05-18 23:26:30 +08:00
parent 1c1587c816
commit 1f44698134
+25
View File
@@ -332,6 +332,31 @@ async def task_summary(project_id: str):
return {"summary": q.task_summary()}
# --- Archive (v2.8) ---
@router.post("/tasks/{task_id}/archive")
async def archive_task(project_id: str, task_id: str,
body: Optional[Dict[str, Any]] = None):
bb = _bb(project_id)
task = bb.get_task(task_id)
if not task:
raise HTTPException(404, f"Task not found: {task_id}")
action = (body or {}).get("action", "archive")
if action == "unarchive":
bb.unarchive_task(task_id)
return {"ok": True, "action": "unarchived"}
else:
bb.archive_task(task_id)
return {"ok": True, "action": "archived"}
@router.post("/tasks/archive-done")
async def archive_done_tasks(project_id: str):
bb = _bb(project_id)
count = bb.archive_done_tasks()
return {"ok": True, "archived_count": count}
# --- Helper ---
def _task_to_dict(t: Task) -> Dict[str, Any]: