Refactor code structure for improved readability and maintainability
This commit is contained in:
13
app/models/base.py
Normal file
13
app/models/base.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
|
||||
class BaseModel(SQLModel):
|
||||
"""Base model with common fields for all models."""
|
||||
|
||||
id: int | None = Field(primary_key=True, default=None)
|
||||
|
||||
# timestamps
|
||||
created_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
|
||||
updated_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
|
||||
Reference in New Issue
Block a user