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: