Feature: App-Einstellungen in DB (preferred_theme neu, notes_ki+gassi_stunde schon drin) — geräteübergreifend sync (SW by-v785)
This commit is contained in:
parent
2ff6d4dfe4
commit
e8cf742911
8 changed files with 41 additions and 20 deletions
|
|
@ -238,7 +238,9 @@ async def me(user=Depends(get_current_user)):
|
|||
"""SELECT id, name, real_name, email, rolle, is_premium, email_verified,
|
||||
bio, wohnort, erfahrung, social_link,
|
||||
profil_sichtbarkeit, avatar_url, created_at,
|
||||
is_founder, is_partner, founder_number, is_founder_pending
|
||||
is_founder, is_partner, founder_number, is_founder_pending,
|
||||
notes_ki_enabled, gassi_stunde_push,
|
||||
preferred_theme
|
||||
FROM users WHERE id=?""",
|
||||
(user["id"],)
|
||||
).fetchone()
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ class ProfileUpdate(BaseModel):
|
|||
profil_sichtbarkeit: Optional[str] = None
|
||||
notes_ki_enabled: Optional[int] = None
|
||||
gassi_stunde_push: Optional[int] = None
|
||||
preferred_theme: Optional[str] = None
|
||||
|
||||
|
||||
def _load_user(user_id: int) -> dict:
|
||||
|
|
@ -54,6 +55,8 @@ async def update_profile(data: ProfileUpdate, user=Depends(get_current_user)):
|
|||
raise HTTPException(400, f"erfahrung muss eines von {sorted(VALID_ERFAHRUNG)} sein.")
|
||||
if "profil_sichtbarkeit" in fields and fields["profil_sichtbarkeit"] not in VALID_SICHTBARKEIT:
|
||||
raise HTTPException(400, f"profil_sichtbarkeit muss eines von {sorted(VALID_SICHTBARKEIT)} sein.")
|
||||
if "preferred_theme" in fields and fields["preferred_theme"] not in ("system", "light", "dark"):
|
||||
raise HTTPException(400, "preferred_theme muss 'system', 'light' oder 'dark' sein.")
|
||||
if "bio" in fields and len(fields["bio"]) > 300:
|
||||
raise HTTPException(400, "bio darf maximal 300 Zeichen lang sein.")
|
||||
if "wohnort" in fields and len(fields["wohnort"]) > 60:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue