feat(aurora): subclassed jsonencoder to allow for custom behavior

This commit is contained in:
Seaswimmer 2024-05-04 14:18:19 -04:00
parent e5cdd3893f
commit 2da76eb51a
Signed by untrusted user: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -68,3 +68,11 @@ class Moderation(BaseModel):
return cls(**case)
return None
class JSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, datetime):
return o.timestamp()
if isinstance(o, timedelta):
return str(o)
return super().default(o)