Sprint 16: Chat-Fotos/Online/Read-Receipts, Gesundheit-Dokumente löschen, Bugfixes

- Chat: Foto-Versand (POST /api/chat/conversations/{id}/upload, media_url/media_type)
- Chat: Online-Indikator (last_seen Heartbeat, grüner Dot, 3min-Fenster)
- Chat: Read Receipts (read_at, Einzel-/Doppelhaken-Icons)
- Gesundheit: Dokument löschen (DELETE .../dokument, Datei + DB-Eintrag)
- Bug: events.user_id NOT NULL → nullable (Table-Recreation-Migration)
- Bug: scheduler INSERT user_id 0 → NULL
- Bug: Wikidata Rate-Limit: sleep 0.3s→1.0s, retries 2→4, exponentielles Backoff
- SW: by-v146, APP_VER 119
This commit is contained in:
rene 2026-04-17 22:38:33 +02:00
parent 34f29f9d0a
commit a7753c9cf5
15 changed files with 375 additions and 43 deletions

View file

@ -5,9 +5,12 @@ Täglich: Gesundheits-Erinnerungen per Push versenden.
import logging
from datetime import date, datetime, timedelta
from zoneinfo import ZoneInfo
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.triggers.cron import CronTrigger
_TZ = ZoneInfo("Europe/Berlin")
from database import db
from routes.push import send_push_to_user, send_push_to_all
import weather
@ -64,7 +67,7 @@ def start():
_scheduler.add_job(
_job_import_events,
'date',
run_date=datetime.now() + timedelta(seconds=10),
run_date=datetime.now(tz=_TZ) + timedelta(seconds=10),
id="import_events_startup",
replace_existing=True,
)
@ -72,7 +75,7 @@ def start():
_scheduler.add_job(
_job_prewarm_cities,
'date',
run_date=datetime.now() + timedelta(seconds=90),
run_date=datetime.now(tz=_TZ) + timedelta(seconds=90),
id="prewarm_cities_startup",
replace_existing=True,
)
@ -80,7 +83,7 @@ def start():
_scheduler.add_job(
_job_seed_breeds,
'date',
run_date=datetime.now() + timedelta(seconds=15),
run_date=datetime.now(tz=_TZ) + timedelta(seconds=15),
id="seed_breeds_startup",
replace_existing=True,
)
@ -88,7 +91,7 @@ def start():
_scheduler.add_job(
_job_seed_wikidata_breeds,
'date',
run_date=datetime.now() + timedelta(seconds=45),
run_date=datetime.now(tz=_TZ) + timedelta(seconds=45),
id="seed_wikidata_startup",
replace_existing=True,
)
@ -339,7 +342,7 @@ async def _job_import_events():
if not exists:
conn.execute("""
INSERT INTO events (user_id, titel, datum, ort_name, typ, link, quelle, external_id, status)
VALUES (0, ?, ?, ?, ?, ?, 'vdh', ?, 'aktiv')
VALUES (NULL, ?, ?, ?, ?, ?, 'vdh', ?, 'aktiv')
""", (
ev['titel'],
ev['datum'],