Food Enhancesment - Rezepte. Listen, BLS Support #107

Merged
Lars merged 19 commits from develop into main 2026-09-13 15:25:21 +02:00
4 changed files with 16 additions and 4 deletions
Showing only changes of commit 3b46630a37 - Show all commits

View File

@ -184,6 +184,12 @@ known_limitations=(
**Regel:** Kein Join „Name der Liste gegen alle Tagebuchzeilen“. Datum aus der bereits gesetzten FK oder aus dem Eltern-Datensatz.
## 10. `from __future__ import annotations` + FastAPI-Limiter (13.09.2026)
**Was:** `tandoor.py` mit future-annotations und `body: TandoorProbeIn | None` unter `@limiter.limit`.
**Problem:** Pydantic löst den Typ nicht auf → Import-Crash → Backend startet nicht → Login bekommt HTML (`Unexpected token '<'`).
**Lösung:** Kein future-annotations in Routern; `Optional[TandoorProbeIn]`. Import-Test für den Router.
---
**Zusammenfassung Nutrition Cluster:**

View File

@ -1,6 +1,4 @@
"""Per-user Tandoor connection. No recipe import yet."""
from __future__ import annotations
from typing import Optional
from fastapi import APIRouter, Depends, HTTPException
@ -59,7 +57,7 @@ def write_settings(body: TandoorSettingsIn, session: dict = Depends(require_auth
@router.post("/test")
@limiter.limit("10/minute")
def test_connection(request: Request, body: TandoorProbeIn | None = None, session: dict = Depends(require_auth)):
def test_connection(request: Request, body: Optional[TandoorProbeIn] = None, session: dict = Depends(require_auth)):
pid = session["profile_id"]
body = body or TandoorProbeIn()
with get_db() as conn:

View File

@ -1,6 +1,14 @@
from data_layer.tandoor_client import TandoorError, normalize_base_url, public_settings, token_hint
def test_tandoor_router_imports():
from routers import tandoor
paths = {r.path for r in tandoor.router.routes}
assert "/api/tandoor/settings" in paths
assert "/api/tandoor/test" in paths
def test_normalize_https_strips_slash():
assert normalize_base_url("https://tandoor.stommer.de/") == "https://tandoor.stommer.de"

View File

@ -21,7 +21,7 @@ MODULE_VERSIONS = {
"caliper": "1.0.1",
"activity": "1.2.1", # Legacy CSV import: activity_entries feature enforcement
"nutrition": "1.3.3", # Unmapped ohne Kreuzjoin; Listen-Import Rebuild async
"tandoor": "1.0.0", # Per-user URL + Token + Verbindungstest
"tandoor": "1.0.1", # Router-Import ohne future-annotations (Backend startet)
"bls": "1.0.5", # GET /bls/units
"photos": "1.0.0",
"insights": "1.3.0",