Add department self-serve config versioning routes with lifecycle actions (list, validate, publish, rollback) and associated logic for managing config versions.

This commit is contained in:
Jeppe Bundgaard
2026-03-25 17:54:41 +01:00
parent 482a17f093
commit 76729f1b99
24 changed files with 1722 additions and 43 deletions
@@ -24,8 +24,27 @@ function selfserve_openapi_content_or_skip(): string
test()->markTestSkipped('openapi.yaml is not available in this runtime environment.');
}
function selfserve_openapi_path_block_or_fail(string $content, string $path): string
{
$path_marker = ' ' . $path . ':';
$start = strpos($content, $path_marker);
if ($start === false) {
throw new RuntimeException("OpenAPI path block not found: {$path}");
}
$rest = substr($content, $start + strlen($path_marker));
$next_path = strpos($rest, "\n /");
if ($next_path === false) {
return substr($content, $start);
}
return substr($content, $start, strlen($path_marker) + $next_path);
}
it('documents self-serve machine type, eligibility, summary, and webhook endpoints', function (): void {
$content = selfserve_openapi_content_or_skip();
$allowedPathBlock = selfserve_openapi_path_block_or_fail($content, '/department/selfserve/vehicle/allowed');
$summaryPathBlock = selfserve_openapi_path_block_or_fail($content, '/department/selfserve/washes/summary');
expect($content)->toContain('/department/selfserve/machine-types:');
expect($content)->toContain('/department/selfserve/vehicle/allowed:');
@@ -39,6 +58,10 @@ it('documents self-serve machine type, eligibility, summary, and webhook endpoin
expect($content)->toContain('/modules/self-serve/lane/relay/machine_program_picker/set:');
expect($content)->toContain('/modules/self-serve/lane/relay/machine_cleaner/status:');
expect($content)->toContain('/modules/self-serve/lane/relay/machine_cleaner/set:');
expect($allowedPathBlock)->toContain('vehicle_type_id:');
expect($allowedPathBlock)->toContain('vehicle_type:');
expect($summaryPathBlock)->toContain('vehicle_type_id:');
expect($summaryPathBlock)->toContain('vehicle_type:');
});
it('defines reusable self-serve wash and machine type schemas', function (): void {
@@ -52,3 +75,14 @@ it('defines reusable self-serve wash and machine type schemas', function (): voi
expect($content)->toContain('machine_type_id:');
expect($content)->toContain('SelfServeLaneMachineRelayStatus:');
});
it('documents in-progress self-serve wash start and machine relay fields', function (): void {
$content = selfserve_openapi_content_or_skip();
$inProgressPathBlock = selfserve_openapi_path_block_or_fail($content, '/modules/self-serve/lane/wash/in-progress');
expect($inProgressPathBlock)->toContain('included_minutes:');
expect($inProgressPathBlock)->toContain('machine_relay_enabled:');
expect($inProgressPathBlock)->toContain('machine_relay_enabled_at:');
expect($inProgressPathBlock)->toContain('machine_start_triggered_at:');
expect($inProgressPathBlock)->toContain('wash_started_at:');
});