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

@@ -4,6 +4,8 @@ User Login Log Database Model
from datetime import datetime
from app.utils import utcnow
from sqlmodel import Field, SQLModel
@@ -16,7 +18,7 @@ class UserLoginLog(SQLModel, table=True):
user_id: int = Field(index=True, description="User ID")
ip_address: str = Field(max_length=45, index=True, description="IP address (supports IPv4 and IPv6)")
user_agent: str | None = Field(default=None, max_length=500, description="User agent information")
login_time: datetime = Field(default_factory=datetime.utcnow, description="Login time")
login_time: datetime = Field(default_factory=utcnow, description="Login time")
# GeoIP information
country_code: str | None = Field(default=None, max_length=2, description="Country code")