1
0
Fork 0
fahrPool/web
Jonny c758dd2305 fix: allow schaden photos during unterwegs and close final-review gaps
Final whole-branch review before merging feature/auftragsverwaltung found
two Important and three Minor issues, all fixed in this round:

- auftrag_fotos and storage.objects INSERT policies now split the
  condition: Pflicht-positions still require status = 'zugewiesen', but
  schaden photos may additionally be uploaded while status = 'unterwegs',
  matching the spec's "jederzeit waehrend der Fahrt nachtragen" requirement.
- Added schadenFotoNachtragen server action + a page form so drivers can
  actually use the new mid-trip upload window.
- Added supabase/tests/auftrag_fotos_rls_test.sql (12 pgTAP tests) covering
  SELECT/INSERT RLS on both auftrag_fotos and storage.objects, including the
  new unterwegs-schaden-allowed / unterwegs-pflicht-blocked cases.
- fahrtBeginnen now checks affected row count like fahrtBeenden/stornieren
  instead of only checking `error`.
- /auftraege/neu now gates on role (admin/disponent) via loadProfile(),
  redirecting non-privileged roles back to /auftraege with a visible error
  (which now renders the error query param).
- Renamed the over-long storage INSERT policy name to stay under the 63
  byte Postgres identifier limit.

Migrations were edited in place rather than layered with a new migration,
following the established precedent (55c4ac5) for pre-merge, not-yet-deployed
RLS fixes on this branch.

Verified: npx supabase db reset clean, npx supabase test db 33/33 passing
(was 21), npm run build and npm test green in web/, and a live rolled-back
SQL probe confirming a driver can insert a schaden photo but not a Pflicht
photo while status = 'unterwegs'.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-06 06:57:22 +02:00
..
app fix: allow schaden photos during unterwegs and close final-review gaps 2026-07-06 06:57:22 +02:00
components feat: add auftraege list page with role-aware sections 2026-07-05 21:45:27 +02:00
lib feat: add fahrt-beenden, stornieren and folgeauftrag suggestion 2026-07-05 22:36:19 +02:00
public chore: scaffold Next.js app with Vitest 2026-07-04 10:58:26 +02:00
.dockerignore feat: containerize the Next.js app and wire it into docker-compose 2026-07-05 00:25:01 +02:00
.env.local.example feat: containerize the Next.js app and wire it into docker-compose 2026-07-05 00:25:01 +02:00
.gitignore feat: add Supabase browser and server client helpers 2026-07-04 15:32:05 +02:00
Dockerfile feat: containerize the Next.js app and wire it into docker-compose 2026-07-05 00:25:01 +02:00
README.md docs: add root setup README and fix stale auth.user_role() reference 2026-07-05 00:45:39 +02:00
eslint.config.mjs chore: scaffold Next.js app with Vitest 2026-07-04 10:58:26 +02:00
middleware.ts feat: add auth middleware with session refresh and redirects 2026-07-04 15:57:41 +02:00
next.config.ts chore: scaffold Next.js app with Vitest 2026-07-04 10:58:26 +02:00
package-lock.json feat: add Supabase browser and server client helpers 2026-07-04 15:32:05 +02:00
package.json feat: add Supabase browser and server client helpers 2026-07-04 15:32:05 +02:00
tsconfig.json chore: scaffold Next.js app with Vitest 2026-07-04 10:58:26 +02:00
vitest.config.ts chore: scaffold Next.js app with Vitest 2026-07-04 10:58:26 +02:00

README.md

web

See the root README.md for the full setup sequence — this is a sub-directory of a larger self-hosted Supabase + Next.js project, not a standalone create-next-app.