mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-28 19:56:39 +00:00
refactor(tokens-repo): split out date field detection
This commit is contained in:
parent
bf6c230ae0
commit
257096084f
|
@ -87,10 +87,15 @@ class RedisTokensRepository(AbstractTokensRepository):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _prepare_model_dict(d: dict):
|
def _is_date_key(key: str):
|
||||||
for date in [
|
return key in [
|
||||||
"created_at",
|
"created_at",
|
||||||
]:
|
]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _prepare_model_dict(d: dict):
|
||||||
|
date_keys = [key for key in d.keys() if RedisTokensRepository._is_date_key(key)]
|
||||||
|
for date in date_keys:
|
||||||
if d[date] != "None":
|
if d[date] != "None":
|
||||||
d[date] = datetime.fromisoformat(d[date])
|
d[date] = datetime.fromisoformat(d[date])
|
||||||
for key in d.keys():
|
for key in d.keys():
|
||||||
|
|
Loading…
Reference in a new issue