parse date from dict

This commit is contained in:
dni ⚡
2024-10-17 10:37:42 +02:00
parent edd72fd5db
commit b4c57c0faf
+3
View File
@@ -643,6 +643,9 @@ def dict_to_model(_row: dict, model: type[TModel]) -> TModel:
logger.warning(f"Converting {key} to model `{model}`.")
continue
type_ = model.__fields__[key].type_
if issubclass(type_, datetime.datetime):
_dict[key] = datetime.datetime.fromtimestamp(value)
continue
if issubclass(type_, bool):
_dict[key] = bool(value)
continue