Fix datetime serialization in _dto_to_dict
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m10s

Use dto_to_dict() from shared/contracts/dtos.py for dataclass
serialization instead of raw dataclasses.asdict(). This ensures
datetimes are converted to ISO format strings (not RFC 2822 from
jsonify), matching what dto_from_dict() expects on the receiving end.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 08:28:47 +00:00
parent 41e803335a
commit 486ab834de

View File

@@ -226,8 +226,8 @@ def _dto_to_dict(obj: Any) -> dict[str, Any]:
without parsing date strings.
"""
if hasattr(obj, "__dataclass_fields__"):
import dataclasses
d = dataclasses.asdict(obj)
from shared.contracts.dtos import dto_to_dict
return dto_to_dict(obj)
elif hasattr(obj, "_asdict"):
d = dict(obj._asdict())
elif hasattr(obj, "__dict__"):