refactor(project): use unified utcnow

This commit is contained in:
MingxuanGame
2025-08-22 11:27:45 +00:00
parent da66420eaa
commit 9b00dbda28
49 changed files with 201 additions and 167 deletions

View File

@@ -1,7 +1,8 @@
from datetime import UTC, datetime
from datetime import datetime
from typing import Any
from app.models.model import UTCBaseModel
from app.utils import utcnow
from sqlmodel import (
JSON,
@@ -24,7 +25,7 @@ class MultiplayerEventBase(SQLModel, UTCBaseModel):
sa_column=Column(
DateTime(timezone=True),
),
default=datetime.now(UTC),
default_factory=utcnow,
)
event_type: str = Field(index=True)
@@ -40,7 +41,7 @@ class MultiplayerEvent(MultiplayerEventBase, table=True):
sa_column=Column(
DateTime(timezone=True),
),
default=datetime.now(UTC),
default_factory=utcnow,
)
event_detail: dict[str, Any] | None = Field(
sa_column=Column(JSON),