From 9a8d36068ae1cfc314028b8f9726cfe8e207c656 Mon Sep 17 00:00:00 2001 From: Celes Renata Date: Thu, 16 Apr 2026 15:25:40 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20convert=20Decimal=20to=20float=20in=20AP?= =?UTF-8?q?I=20responses=20instead=20of=20string=20=E2=80=94=20fixes=20pos?= =?UTF-8?q?itions=20page=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/api/app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/api/app.py b/services/api/app.py index 78d1425..9ea6afd 100644 --- a/services/api/app.py +++ b/services/api/app.py @@ -82,10 +82,17 @@ app.add_middleware(TraceMiddleware) def _row_to_dict(row: asyncpg.Record) -> dict[str, Any]: """Convert an asyncpg Record to a JSON-safe dict.""" + from decimal import Decimal + from uuid import UUID + d: dict[str, Any] = {} for key, val in dict(row).items(): if isinstance(val, datetime): d[key] = val.isoformat() + elif isinstance(val, Decimal): + d[key] = float(val) + elif isinstance(val, UUID): + d[key] = str(val) elif hasattr(val, "__str__") and not isinstance(val, (str, int, float, bool, list, dict, type(None))): d[key] = str(val) else: