Fix datetime serialization in _dto_to_dict
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m10s
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:
@@ -226,8 +226,8 @@ def _dto_to_dict(obj: Any) -> dict[str, Any]:
|
|||||||
without parsing date strings.
|
without parsing date strings.
|
||||||
"""
|
"""
|
||||||
if hasattr(obj, "__dataclass_fields__"):
|
if hasattr(obj, "__dataclass_fields__"):
|
||||||
import dataclasses
|
from shared.contracts.dtos import dto_to_dict
|
||||||
d = dataclasses.asdict(obj)
|
return dto_to_dict(obj)
|
||||||
elif hasattr(obj, "_asdict"):
|
elif hasattr(obj, "_asdict"):
|
||||||
d = dict(obj._asdict())
|
d = dict(obj._asdict())
|
||||||
elif hasattr(obj, "__dict__"):
|
elif hasattr(obj, "__dict__"):
|
||||||
|
|||||||
Reference in New Issue
Block a user