From da7f3822c1992a7151cf58b78ec4fcf45e4ac51c Mon Sep 17 00:00:00 2001 From: Claude Dev Date: Tue, 24 Mar 2026 13:30:52 +0100 Subject: [PATCH] API: globe-incidents Endpoint fuer Lage-Auswahl im Globe --- src/routers/public_api.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/routers/public_api.py b/src/routers/public_api.py index 917d93e..70156de 100644 --- a/src/routers/public_api.py +++ b/src/routers/public_api.py @@ -229,6 +229,19 @@ async def globe_ingest( await db.commit() return {"ok": True, "inserted": inserted, "total_sent": len(events)} + + +@router.get("/globe-incidents", dependencies=[Depends(verify_api_key)]) +async def get_globe_incidents(db=Depends(db_dependency)): + """Liste aller oeffentlichen aktiven Lagen fuer Globe-Auswahl.""" + cursor = await db.execute( + """SELECT id, title, type, status, updated_at + FROM incidents + WHERE status IN ('active','archived') AND visibility = 'public' + ORDER BY updated_at DESC LIMIT 30""" + ) + return [dict(r) for r in await cursor.fetchall()] + @router.get("/globe-feed", dependencies=[Depends(verify_api_key)]) async def get_globe_feed( incident_id: int = None,