Feature: User-Geburtstag im Profil + Glückwunsch in JETZT-Welt

Settings:
- Feld 'Dein Geburtstag (optional)' im Profil-Formular (Format MM-TT)
- Hinweis: nur für Geburtstagsgrüße, kein Jahr nötig
- profile.py: geburtstag gespeichert + Format-Validierung MM-DD

JETZT-Welt wenn heute User-Geburtstag:
- Greet-Text: 'Herzlichen Glückwunsch' statt Tageszeit-Gruß
- Animiertes Geburtstags-Reminder-Card (confetti + cake Icons)
- 'Alles Gute zum Geburtstag, [Name]!'

SW by-v1028, APP_VER 1028
This commit is contained in:
rene 2026-05-16 11:55:34 +02:00
parent 1328e2c4e3
commit a4377033ec
6 changed files with 48 additions and 5 deletions

View file

@ -2,6 +2,7 @@
import io
import os
import re
import uuid
from typing import Optional
@ -29,6 +30,7 @@ class ProfileUpdate(BaseModel):
gassi_stunde_push: Optional[int] = None
preferred_theme: Optional[str] = None
billing_address: Optional[str] = None
geburtstag: Optional[str] = None
def _load_user(user_id: int) -> dict:
@ -36,7 +38,8 @@ def _load_user(user_id: int) -> dict:
row = conn.execute(
"""SELECT id, name, real_name, email, rolle, is_premium, email_verified,
bio, wohnort, erfahrung, social_link,
profil_sichtbarkeit, avatar_url, created_at, billing_address
profil_sichtbarkeit, avatar_url, created_at, billing_address,
geburtstag
FROM users WHERE id=?""",
(user_id,)
).fetchone()
@ -64,6 +67,9 @@ async def update_profile(data: ProfileUpdate, user=Depends(get_current_user)):
raise HTTPException(400, "wohnort darf maximal 60 Zeichen lang sein.")
if "social_link" in fields and len(fields["social_link"]) > 120:
raise HTTPException(400, "social_link darf maximal 120 Zeichen lang sein.")
if "geburtstag" in fields and fields["geburtstag"]:
if not re.fullmatch(r"\d{2}-\d{2}", fields["geburtstag"]):
raise HTTPException(400, "geburtstag muss im Format MM-DD sein (z.B. 03-15).")
if not fields:
return _load_user(user["id"])