#!/usr/bin/env bash
# Marker en deferred jobb som completed etter at Claude Code har svart.
# Bruk: ./scripts/vaktmester-complete.sh <job-id>

set -euo pipefail
JOB_ID="${1:?Mangler job-id}"

docker exec sidelinja-postgres-1 psql -U sidelinja -d synops -q -c "
UPDATE job_queue SET status = 'completed', completed_at = now(),
  result = '{\"status\":\"completed\",\"handler\":\"claude-code\"}'::jsonb
WHERE id = '$JOB_ID';
"
echo "Jobb $JOB_ID markert som completed"
