WIP: Moderation type registry #26
2 changed files with 6 additions and 3 deletions
|
@ -5,7 +5,10 @@ from typing import Dict, List, Optional
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
class Moderation(BaseModel):
|
|
||||||
|
class AuroraBaseModel(BaseModel):
|
||||||
|
"""Base class for all models in Aurora."""
|
||||||
|
class Moderation(AuroraBaseModel):
|
||||||
moderation_id: int
|
moderation_id: int
|
||||||
guild_id: int
|
guild_id: int
|
||||||
timestamp: datetime
|
timestamp: datetime
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import json
|
import json
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from aurora.models import AuroraBaseModel
|
||||||
|
|
||||||
|
|
||||||
class JSONEncoder(json.JSONEncoder):
|
class JSONEncoder(json.JSONEncoder):
|
||||||
|
@ -10,7 +10,7 @@ class JSONEncoder(json.JSONEncoder):
|
||||||
return int(o.timestamp())
|
return int(o.timestamp())
|
||||||
if isinstance(o, timedelta):
|
if isinstance(o, timedelta):
|
||||||
return str(o)
|
return str(o)
|
||||||
if isinstance(o, BaseModel):
|
if isinstance(o, AuroraBaseModel):
|
||||||
return o.model_dump()
|
return o.model_dump()
|
||||||
return super().default(o)
|
return super().default(o)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue