fix: Backend-Start nach Tandoor-Router-Import
Future-annotations plus Limiter haben TandoorProbeIn unauflösbar gemacht. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d6838abda7
commit
3b46630a37
|
|
@ -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:**
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user