From 548aebe994a54d4444cff6116dbc395ca42a5e89 Mon Sep 17 00:00:00 2001 From: patrick Date: Tue, 2 Jun 2026 20:03:49 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20QR-Stempel-Status=20korrekt=20=E2=80=93?= =?UTF-8?q?=20Status=20vor=20mid-request=20commit=20ermitteln?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit public_action/auth riefen db.commit() vor _status() auf. SET LOCAL app.bypass_rls gilt nur pro Transaktion; nach dem Commit filterte RLS (mangels app.company_id auf der öffentlichen Route) alle Zeilen weg, sodass open immer False und today leer war. Status jetzt vor dem Commit ermitteln. Co-Authored-By: Claude Opus 4.8 --- backend/app/routers/public_stamp.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/app/routers/public_stamp.py b/backend/app/routers/public_stamp.py index 1b0fc45..ced292c 100644 --- a/backend/app/routers/public_stamp.py +++ b/backend/app/routers/public_stamp.py @@ -104,9 +104,12 @@ async def public_auth( entity_id=user.id, ip=get_client_ip(request), )) + + # Status vor dem Commit ermitteln (siehe public_action: commit() setzt + # SET LOCAL app.bypass_rls zurück → RLS würde danach alle Zeilen filtern). + status = await _status(user, db) await db.commit() - status = await _status(user, db) return PublicStampAuthResponse( session_token=session_token, user_name=_display_name(user), @@ -149,7 +152,11 @@ async def public_action( entity_id=user.id, ip=get_client_ip(request), )) + + # Status VOR dem Commit ermitteln: ein zwischenzeitliches commit() beendet die + # Transaktion und setzt `SET LOCAL app.bypass_rls` zurück – danach würde RLS + # (mangels app.company_id auf dieser öffentlichen Route) alle Zeilen filtern. + status = await _status(user, db) await db.commit() - status = await _status(user, db) return PublicStampActionResponse(warnings=warnings, **status)