first add

This commit is contained in:
2025-10-13 21:05:00 +08:00
parent c7744836e9
commit d71163df00
29 changed files with 144656 additions and 37 deletions

View File

@@ -0,0 +1,25 @@
"""基础模型"""
from datetime import datetime
from sqlmodel import SQLModel, Field
from uuid import uuid4
def generate_uuid() -> str:
"""生成 UUID"""
return str(uuid4())
class TimestampModel(SQLModel):
"""时间戳 Mixin"""
created_at: datetime = Field(
default_factory=datetime.utcnow,
nullable=False,
sa_column_kwargs={"index": True},
)
updated_at: datetime = Field(
default_factory=datetime.utcnow,
nullable=False,
sa_column_kwargs={"onupdate": datetime.utcnow},
)