WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
2 changed files with 6 additions and 3 deletions
Showing only changes of commit 2dfc9d9824 - Show all commits

View file

@ -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

View file

@ -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)