feat: add begin repair workflow

This commit is contained in:
lussierj committed 2026-07-29 14:50:46 +00:00
1 parent d738b8e27e
commit f6a2512e23
21 files changed
+3108 -5

No files matched your search

+36 -1
View File
@@ -88,7 +88,7 @@ health_json="$(cat "${health_file}")"
echo "Checking migrations and required schema..."
current_revision="$("${compose[@]}" exec -T backend alembic current 2>/dev/null)"
[[ "${current_revision}" == *"0009_inventory_asset_id_history"* ]]
[[ "${current_revision}" == *"0010_begin_repair"* ]]
missing_tables="$(
"${compose[@]}" exec -T postgres sh -c \
@@ -162,6 +162,41 @@ done
[[ "$(status_for "${readonly_cookie}" GET /locations)" == "200" ]]
[[ "$(status_for "${readonly_cookie}" POST /api/rooms '{"name":"Must Not Be Created"}')" == "403" ]]
echo "Checking Begin Repair permission and workflow..."
"${compose[@]}" exec -T postgres sh -ec \
'psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$POSTGRES_DB"' <<'SQL'
INSERT INTO miners (
id,
asset_tag,
status,
lifecycle_status,
first_seen_at,
last_seen_at
)
VALUES (
'00000000-0000-0000-0000-000000000981',
'SMOKE-REPAIR-001',
'unknown',
'active',
NULL,
NULL
);
SQL
[[ "$(
status_for "${readonly_cookie}" POST /api/repairs \
'{"miner_id":"00000000-0000-0000-0000-000000000981","reason":"CONTROL_BOARD"}'
)" == "403" ]]
begin_repair_response="$(curl --fail --silent -b "${technician_cookie}" \
-H 'Content-Type: application/json' \
--data '{"miner_id":"00000000-0000-0000-0000-000000000981","reason":"CONTROL_BOARD","notes":"Smoke test repair."}' \
"${base_url}/api/repairs")"
[[ "${begin_repair_response}" == *'"status":"OPEN"'* ]]
[[ "${begin_repair_response}" == *'"reason":"CONTROL_BOARD"'* ]]
[[ "$(
status_for "${technician_cookie}" POST /api/repairs \
'{"miner_id":"00000000-0000-0000-0000-000000000981","reason":"CONTROL_BOARD"}'
)" == "409" ]]
room_status="$(status_for "${technician_cookie}" POST /api/rooms '{"name":"Role Matrix Test Room"}')"
[[ "${room_status}" == "200" || "${room_status}" == "201" ]]