auto-sync: 2026-05-20 20:42:28
This commit is contained in:
@@ -97,6 +97,7 @@ async def move_task(project_id: str, task_id: str, body: Dict[str, Any]):
|
||||
|
||||
# 从源项目读任务
|
||||
from src.blackboard.db import Blackboard
|
||||
from src.blackboard.models import Task
|
||||
src_bb = Blackboard(Path(reg.root) / project_id / "blackboard.db")
|
||||
task = src_bb.get_task(task_id)
|
||||
if not task:
|
||||
@@ -104,14 +105,18 @@ async def move_task(project_id: str, task_id: str, body: Dict[str, Any]):
|
||||
|
||||
# 写入目标项目
|
||||
tgt_bb = Blackboard(Path(reg.root) / target_project / "blackboard.db")
|
||||
task_data = {k: getattr(task, k) for k in [
|
||||
"id", "title", "description", "status", "assignee", "assigned_by",
|
||||
"priority", "task_type", "risk_level", "parent_task", "stage",
|
||||
"depends_on", "stages_json",
|
||||
] if getattr(task, k, None) is not None}
|
||||
tgt_bb.create_task_from_dict(task_data)
|
||||
# 重置状态和时间为初始值
|
||||
moved_task = Task(
|
||||
id=task.id, title=task.title, description=task.description,
|
||||
status="pending", assignee=task.assignee, assigned_by=task.assigned_by,
|
||||
priority=task.priority, task_type=task.task_type,
|
||||
risk_level=task.risk_level, parent_task=task.parent_task,
|
||||
stage=task.stage, stages_json=task.stages_json,
|
||||
depends_on=task.depends_on, must_haves=task.must_haves,
|
||||
)
|
||||
tgt_bb.create_task(moved_task)
|
||||
|
||||
# 从源项目删除(归档式删除)
|
||||
src_bb.update_task_status(task_id, "cancelled")
|
||||
# 从源项目标记 cancelled
|
||||
src_bb.update_task_status(task_id, "cancelled", detail=f"Moved to {target_project}")
|
||||
|
||||
return {"ok": True, "moved_to": target_project}
|
||||
|
||||
Reference in New Issue
Block a user