fix(workbench): remove synthetic check projections
This commit is contained in:
@@ -25,7 +25,7 @@ class ManagedStore:
|
||||
return command.model_dump(mode="json", exclude={"request_id"}) | {
|
||||
"work_order_id": str(uuid4()), "project_id": str(PROJECT_ID), "revision": 1,
|
||||
"origin": "synthetic", "created_at": now, "updated_at": now,
|
||||
"created_by": str(USER_ID), "updated_by": str(USER_ID),
|
||||
"created_by": str(USER_ID), "updated_by": str(USER_ID), "activity": [],
|
||||
}
|
||||
|
||||
def update_work_order(self, who, work_order_id, command):
|
||||
@@ -35,7 +35,7 @@ class ManagedStore:
|
||||
"status": command.status or "open", "priority": command.priority or "normal",
|
||||
"assignee": None, "scheduled_at": None, "work_order_type": "general",
|
||||
"location": command.location, "scenario_code": command.scenario_code,
|
||||
"subtasks": command.subtasks}})()) | {"revision": command.expected_revision + 1,
|
||||
"feedback_requirements": command.feedback_requirements or []}})()) | {"revision": command.expected_revision + 1,
|
||||
"work_order_id": str(work_order_id)}
|
||||
|
||||
def delete_work_order(self, who, work_order_id, command):
|
||||
@@ -86,32 +86,25 @@ def test_managed_work_order_and_data_routes_are_typed_crud():
|
||||
"status": "open", "priority": "high", "assignee": None, "scheduled_at": None,
|
||||
"work_order_type": "water_quality_complaint", "location": "演示小区",
|
||||
"scenario_code": "WQ-SECONDARY-SUPPLY-001",
|
||||
"subtasks": [{
|
||||
"id": "sampling", "title": "现场采样", "summary": "采集二次供水样本",
|
||||
"status": "running", "scheduled_at": "2026-09-18T01:00:00Z",
|
||||
"location": "演示小区", "assignee": "水质班组", "duration_minutes": 60,
|
||||
"reply_window_minutes": 120, "reply_requirements": ["上传检测结果"],
|
||||
"stages": [{"id": "dispatch", "sequence": 1, "title": "派发",
|
||||
"status": "current", "owner": "调度员", "time_label": "待执行",
|
||||
"description": "确认采样人员"}],
|
||||
}],
|
||||
"feedback_requirements": ["上传检测结果"],
|
||||
})
|
||||
assert created.status_code == 201 and created.json()["origin"] == "synthetic"
|
||||
assert created.json()["work_order_type"] == "water_quality_complaint"
|
||||
assert created.json()["location"] == "演示小区"
|
||||
assert created.json()["scenario_code"] == "WQ-SECONDARY-SUPPLY-001"
|
||||
assert created.json()["subtasks"][0]["stages"][0]["status"] == "current"
|
||||
assert created.json()["feedback_requirements"] == ["上传检测结果"]
|
||||
assert "subtasks" not in created.json()
|
||||
work_order_id = created.json()["work_order_id"]
|
||||
changed = client.patch(f"/api/sample/v1/work-orders/{work_order_id}", json={
|
||||
"request_id": str(uuid4()), "expected_revision": 1, "status": "awaiting_reply",
|
||||
"location": "复测点", "clear_scenario_code": True, "clear_subtasks": True,
|
||||
"location": "复测点", "clear_scenario_code": True, "progress_note": "等待现场检测结果",
|
||||
"clear_assignee": False, "clear_scheduled_at": False,
|
||||
})
|
||||
assert changed.status_code == 200 and changed.json()["revision"] == 2
|
||||
assert changed.json()["status"] == "awaiting_reply"
|
||||
update_command = next(call[3] for call in fake.calls if call[0] == "update_work_order")
|
||||
assert update_command.location == "复测点"
|
||||
assert update_command.clear_scenario_code and update_command.clear_subtasks
|
||||
assert update_command.clear_scenario_code and update_command.progress_note == "等待现场检测结果"
|
||||
deleted = client.request("DELETE", f"/api/sample/v1/work-orders/{work_order_id}", json={
|
||||
"request_id": str(uuid4()), "expected_revision": 2,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user