Add dynamic_images_vehicle_type column to legacy self-serve schemas, update wash flow logic, and add unit tests for schema compatibility.

This commit is contained in:
Jeppe Bundgaard
2026-03-26 11:58:12 +01:00
parent f148b39a85
commit a4654398d0
5 changed files with 20 additions and 2 deletions
@@ -253,6 +253,7 @@ class selfserve_wash_flow implements selfserve_wash_flow_i
'description' => $row['description'] === null ? null : (string)$row['description'],
'services' => $this->normalizeJsonArray($row['services'] ?? null),
'buttons' => $this->normalizeJsonArray($row['buttons'] ?? null),
'dynamic_images_vehicle_type' => $row['dynamic_images_vehicle_type'] ? (int)$row['dynamic_images_vehicle_type'] : null,
];
}, (new selfserve_wash_session_tasks_o())->listBySession($sessionId));
@@ -407,6 +408,7 @@ class selfserve_wash_flow implements selfserve_wash_flow_i
'order_priority' => (int)($task['order_priority'] ?? 0),
'services' => $this->normalizeServiceNames($this->normalizeJsonArray($task['services'] ?? null)),
'buttons' => $this->normalizeIntArray($this->normalizeJsonArray($task['buttons'] ?? null)),
'dynamic_images_vehicle_type' => (int)($task['dynamic_images_vehicle_type'] ?? 0),
];
}
usort($activeTasks, static fn(array $a, array $b): int => $a['order_priority'] <=> $b['order_priority']);
@@ -736,7 +738,7 @@ class selfserve_wash_flow implements selfserve_wash_flow_i
(string)$task['description'],
$task['services'],
$task['buttons'],
$task['dynamic_images_vehicle_type'] ?? null,
(int)($task['dynamic_images_vehicle_type'] ?? 0) ?: null
);
}
}