- profiles_rls_test.sql: fehlende negative Assertion ergaenzt, die
sicherstellt, dass der Fahrer-Testnutzer 44444444... weiterhin KEIN
Readonly-Profil sieht (Policy bleibt scharf auf role in
('admin','disponent') begrenzt). plan(12) -> plan(13).
- design.md: Aussage zu erstellt_von im Auftrag-Typ korrigiert (nullable
statt immer vorhanden), passend zum bereits umgesetzten Code und zum
Nachtrag in Abschnitt 1 der gleichen Spec.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Neue Policy fuer Ersteller-Anzeige im Auftrag (Task 2/3 folgen). Bestehende
Assertion "Fahrer sieht nur das eigene Profil" testete eine Einschraenkung,
die dieses Feature bewusst aufhebt -- Erwartungswert und Titel angepasst,
statt der Policy, auf Anweisung des Plan-Autors.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Photos are now optional when a driver starts a trip: the 8 vehicle photo
fields remain in the form but no longer carry the required attribute, are
labeled "(optional)", and validateFahrtBeginn no longer checks for missing
positions. Combined with the DB trigger fix in 9f410cb/eaa5faa, a trip can
now begin with zero, some, or all photos uploaded.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Restore the security-review context comment that explains why the
storniert status check is necessary. This comment was part of the
original trigger function body and should be preserved for future
maintainers who inspect the function directly in the database.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
- 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
Task 2's implementer found that check_auftrag_status_transition() independently
blocks the zugewiesen->unterwegs transition below 8 photos, duplicating the
app-level check removed in Task 1. Insert a new Task 2 (migration + pgTAP test
update) and correct the "no schema change" claims accordingly.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
- Add fotos.ts: loadAuftragFotos query function and sortiereUndBeschrifteFotos utility
- Add fotos.test.ts: 6 unit tests for sorting/labeling logic
- Update vitest.config.ts: add path alias resolution for @/ imports
React 19 forbids setting encType/method on a <form> whose action is a
function - it manages FormData (including files) itself. The extra
attribute triggered a console error and blocked "Fahrt beginnen" /
"Schadensfoto nachtragen" whenever photos were attached.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Finding 1: React 19's native <form action={fn}> resets uncontrolled
fields once fn resolves without throwing, regardless of an app-level
{success:false} result. Since handleSubmit never throws, every failed
submit (e.g. duplicate Kennzeichen) silently wiped user edits. Switched
all four Standorte/Fahrzeuge inline-edit and create forms to a plain
onSubmit handler that calls event.preventDefault() and builds FormData
from the submitted element manually, sidestepping React's action-reset
machinery.
Finding 2: web/app/standorte/actions.ts and web/app/fahrzeuge/actions.ts
each declared their own MutationResult type shadowing the differently
shaped MutationResult exported from lib/orte-fahrzeuge/mutations.ts.
Renamed the local type to ActionResult in both files to remove the
name collision.
Task 5 of the standorte-fahrzeuge-tabellen plan: point the nav at the
new /standorte and /fahrzeuge routes built in tasks 1-4, and remove the
now-dead old combined /stammdaten page and its now-unreferenced
loadOrt/loadFahrzeug query helpers.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Admin-Client mit Service-Role-Key, Validierung, Nutzerliste-Merge aus
profiles + auth.admin.listUsers, vier Server Actions und die Seite in
6 Tasks.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Admin kann Nutzer anlegen, Rollen aendern und ueber die Supabase Admin
API sperren/entsperren -- RLS ist hier bewusst nicht die Grenze, die
Server-Action-Rollenpruefung ist es.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Page and CSV export now both render shift timestamps in Europe/Berlin
consistently (previously CSV used UTC, page used server-local time,
causing the same shift to show different clock times in each place).
Also adds a partial unique index so two near-simultaneous Kommen
requests for the same fahrer can no longer create two open shifts --
the existing app-layer check was check-then-act with no DB backstop.