diff --git a/backend/routers/profiles.py b/backend/routers/profiles.py index b9937ea..6bff787 100644 --- a/backend/routers/profiles.py +++ b/backend/routers/profiles.py @@ -29,6 +29,20 @@ def get_pid(x_profile_id: Optional[str] = Header(default=None)) -> str: raise HTTPException(400, "Kein Profil gefunden") +# ── Current User Profile ────────────────────────────────────────────────────── +@router.get("/profiles/me") +def get_current_profile(session=Depends(require_auth)): + """Get current user's profile (for auth check on refresh).""" + profile_id = session['profile_id'] + with get_db() as conn: + cur = get_cursor(conn) + cur.execute("SELECT * FROM profiles WHERE id=%s", (profile_id,)) + row = cur.fetchone() + if not row: + raise HTTPException(404, "Profil nicht gefunden") + return r2d(row) + + # ── Admin Profile Management ────────────────────────────────────────────────── @router.get("/profiles") def list_profiles(session=Depends(require_auth)):