Sprint 18: Notification Center, Routen entdecken, Onboarding, Admin-Erweiterungen

- Notifications: History-Tabelle, /api/notifications Endpoints, push.py schreibt in DB
- Notifications: Page (notifications.js) mit Badge, Typen-Icons, gelesen-Markierung
- Routen: Entdecken-Modus mit Ersteller-Anzeige, Nearby-Filter, Mine/Discover Toggle
- Onboarding: Willkommens-Modal nach Registrierung, Push-Angebot nach Login
- Admin: Scheduler-Tab (Jobs anzeigen + manuell triggern), System-Health (DB/Disk/Uptime)
- Admin: Audit-Log (wer hat was wann gemacht), erweiterte Stats (Push-Abos, aktive User, Routen)
- SW: by-v152, APP_VER 125
This commit is contained in:
rene 2026-04-17 23:21:48 +02:00
parent 5927d384bf
commit 92620c2c52
14 changed files with 1035 additions and 46 deletions

View file

@ -104,7 +104,7 @@ def send_push(subscription_row, payload: dict) -> bool:
def send_push_to_user(user_id: int, payload: dict):
"""Schickt Push an alle Subscriptions eines Users."""
"""Schickt Push an alle Subscriptions eines Users und speichert Notification in DB."""
with db() as conn:
rows = conn.execute(
"SELECT * FROM push_subscriptions WHERE user_id=?", (user_id,)
@ -113,6 +113,20 @@ def send_push_to_user(user_id: int, payload: dict):
for row in rows:
if send_push(row, payload):
sent += 1
# Notification in DB persistieren (unabhängig vom Push-Versand)
notif_type = payload.get("type", "info")
notif_title = payload.get("title", "Benachrichtigung")
notif_body = payload.get("body") or payload.get("message")
notif_data = json.dumps({k: v for k, v in payload.items()
if k not in ("type", "title", "body", "message")}) or None
with db() as conn:
conn.execute(
"""INSERT INTO notifications (user_id, type, title, body, data)
VALUES (?, ?, ?, ?, ?)""",
(user_id, notif_type, notif_title, notif_body, notif_data),
)
return sent