1
0
Fork 0
Commit Graph

3 Commits

Author SHA1 Message Date
Jonny 9f410cbe80 fix: remove photo-count check from DB trigger, photos now optional at Fahrtbeginn
- Add migration 20260818120000_auftrag_fotos_optional_trigger.sql that replaces
  check_auftrag_status_transition() function, removing ONLY the photo-count check
  while preserving all other validation (start_km, end_km, uebergabe_bestaetigt_at,
  status transitions, column lockdown, role-based restrictions)
- Update pgTAP test: plan(13) -> plan(12), replace photo-mandatory test with
  test verifying transition succeeds without photos
- Completes DB-level optional photos feature (app-level optional already done in Task 1)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
2026-08-18 16:32:34 +02:00
Jonny 58e34a14a6 fix: close stornieren RLS gap and harden fahrtBeenden/stornieren
Security review (automated scan + Task 11 reviewer) found a fahrer could
storniere their own assigned order because Task 2's fahrer UPDATE policy
only constrains zugewiesen_an, never status. Adds a role-gated check to
the status trigger (only admin/disponent may set status='storniert') plus
a pgTAP regression test. Also hardens fahrtBeenden/stornieren to check
affected-row counts instead of silently redirecting to a success page on
a blocked update.

Live-verified: fahrer storno attempt now rejected by the trigger; normal
fahrer fahrtBeenden flow unaffected. db reset + test db (21/21), build,
and npm test (17/17) all pass.
2026-07-06 06:22:53 +02:00
Jonny dd725b5027 feat: add auftrag status transition trigger with pgTAP coverage 2026-07-05 17:01:43 +02:00