parse date from dict

This commit is contained in:
dni ⚡
2024-10-10 09:08:27 +02:00
parent e217e58bb6
commit ed81ca55d9
+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