Sprint 15: Zeitzone-Fix, Gewichts-Sync, Öffnungszeiten, KI-Bericht, POI-Moderation — SW by-v432, APP_VER 411
- client_time: Browser-Lokalzeit bei allen Creates mitschicken (Tagebuch, Notizen, Forum, Verlorener Hund, Routen) — kein UTC-Versatz mehr bei Einträgen - Gewicht-Sync: health typ=gewicht schreibt dogs.gewicht_kg, einmalige Migration - Praxen: opening_hours + lat/lon/osm_id in tieraerzte-Tabelle, OSM-Nearby-Lookup, Öffnungszeiten in Karte und Detailansicht - KI-Gesundheitsbericht: alle 2 Wochen automatisch, ki_health_reports-Tabelle, Frontend-Banner mit Archiv (letzten 5 Berichte) - POI-Korrekturen: User schlägt Öffnungszeiten-Änderung vor, Moderatoren-Tab genehmigt/lehnt ab, user_edited-Flag schützt vor Overpass-Überschreibung - timeutils.py: safe_client_time() zentral für alle Routen
This commit is contained in:
parent
679dbdd862
commit
06bd8525ed
21 changed files with 724 additions and 75 deletions
|
|
@ -8,6 +8,7 @@ from typing import Optional, List
|
|||
from database import db
|
||||
from auth import get_current_user, get_current_user_optional
|
||||
from routes.achievements import update_streak, check_and_award
|
||||
from timeutils import safe_client_time
|
||||
from media_utils import convert_media
|
||||
from routes.push import send_push_to_user
|
||||
|
||||
|
|
@ -52,6 +53,7 @@ class RouteCreate(BaseModel):
|
|||
leine_empfohlen: Optional[bool] = None
|
||||
is_public: Optional[bool] = False
|
||||
hunde_tauglichkeit: Optional[str] = None # eingeschränkt | gut | sehr_gut | premium
|
||||
client_time: Optional[str] = None
|
||||
|
||||
class RouteUpdate(BaseModel):
|
||||
name: Optional[str] = None
|
||||
|
|
@ -146,20 +148,21 @@ async def create_route(data: RouteCreate, user=Depends(get_current_user)):
|
|||
gps_json = json.dumps([p.model_dump() for p in data.gps_track])
|
||||
is_valid = int(_check_speed(data.distanz_km, data.dauer_min))
|
||||
|
||||
ct = safe_client_time(data.client_time)
|
||||
with db() as conn:
|
||||
cur = conn.execute("""
|
||||
INSERT INTO routes
|
||||
(user_id, name, beschreibung, gps_track, distanz_km, dauer_min,
|
||||
schwierigkeit, untergrund, schatten, leine_empfohlen, is_public,
|
||||
hunde_tauglichkeit, is_valid)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
hunde_tauglichkeit, is_valid, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""", (
|
||||
user['id'], data.name, data.beschreibung, gps_json,
|
||||
data.distanz_km, data.dauer_min, data.schwierigkeit, data.untergrund,
|
||||
int(data.schatten) if data.schatten is not None else None,
|
||||
int(data.leine_empfohlen) if data.leine_empfohlen is not None else None,
|
||||
int(data.is_public) if data.is_public is not None else 1,
|
||||
data.hunde_tauglichkeit, is_valid,
|
||||
data.hunde_tauglichkeit, is_valid, ct,
|
||||
))
|
||||
row = conn.execute("SELECT * FROM routes WHERE id = ?", (cur.lastrowid,)).fetchone()
|
||||
update_streak(user['id'], conn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue