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