fix(workbench): remove synthetic check projections
This commit is contained in:
@@ -10,7 +10,7 @@ from app.domain.schemas.shared import NonEmptyStr, PositiveInt, StrictModel
|
||||
from app.domain.schemas.operational_data import TaskDataSnapshot
|
||||
from app.domain.schemas.workbench_runtime import (
|
||||
WorkbenchDateTime,
|
||||
WorkbenchRuntimeWorkOrderSubtask,
|
||||
WorkOrderActivity,
|
||||
)
|
||||
|
||||
|
||||
@@ -290,19 +290,17 @@ class ExternalWorkOrderSnapshot(StrictModel):
|
||||
work_order_type: Literal["general", "water_quality_complaint", "burst_report"] = "general"
|
||||
location: NonEmptyStr | None = None
|
||||
scenario_code: NonEmptyStr | None = None
|
||||
subtasks: Annotated[
|
||||
list[WorkbenchRuntimeWorkOrderSubtask], Field(min_length=1, max_length=50)
|
||||
] | None = None
|
||||
feedback_requirements: list[NonEmptyStr] = Field(default_factory=list)
|
||||
activity: list[WorkOrderActivity] = Field(default_factory=list)
|
||||
origin: Literal["synthetic"]
|
||||
updated_at: WorkbenchDateTime
|
||||
|
||||
@model_validator(mode="after")
|
||||
def unique_subtasks(self):
|
||||
if self.subtasks is not None and len(
|
||||
{item.id for item in self.subtasks}
|
||||
) != len(self.subtasks):
|
||||
raise ValueError("work order subtask ids must be unique")
|
||||
return self
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def accept_legacy_snapshot(cls, value):
|
||||
if isinstance(value, dict):
|
||||
return {key: item for key, item in value.items() if key != "subtasks"}
|
||||
return value
|
||||
|
||||
|
||||
class OperationalTaskRun(StrictModel):
|
||||
|
||||
Reference in New Issue
Block a user