Spaces:
Sleeping
Sleeping
Update src/models/audit_log.py
Browse files- src/models/audit_log.py +2 -2
src/models/audit_log.py
CHANGED
|
@@ -11,7 +11,7 @@ class AuditLogBase(SQLModel):
|
|
| 11 |
user_id: str # String user identifier
|
| 12 |
task_id: int # Reference to the affected task
|
| 13 |
event_data: dict = Field(sa_column=Column(JSON)) # JSONB field for event data
|
| 14 |
-
timestamp: datetime = Field(sa_column=Column(DateTime(timezone=True)),
|
| 15 |
|
| 16 |
|
| 17 |
class AuditLog(AuditLogBase, table=True):
|
|
@@ -25,7 +25,7 @@ class AuditLog(AuditLogBase, table=True):
|
|
| 25 |
user_id: str # String user identifier
|
| 26 |
task_id: int # Reference to the affected task
|
| 27 |
event_data: dict = Field(sa_column=Column(JSON)) # JSONB field for event data
|
| 28 |
-
timestamp: datetime = Field(sa_column=Column(DateTime(timezone=True)),
|
| 29 |
|
| 30 |
|
| 31 |
class AuditLogCreate(AuditLogBase):
|
|
|
|
| 11 |
user_id: str # String user identifier
|
| 12 |
task_id: int # Reference to the affected task
|
| 13 |
event_data: dict = Field(sa_column=Column(JSON)) # JSONB field for event data
|
| 14 |
+
timestamp: datetime = Field(sa_column=Column(DateTime(timezone=True)), default_factory=lambda: datetime.now(datetime.UTC))
|
| 15 |
|
| 16 |
|
| 17 |
class AuditLog(AuditLogBase, table=True):
|
|
|
|
| 25 |
user_id: str # String user identifier
|
| 26 |
task_id: int # Reference to the affected task
|
| 27 |
event_data: dict = Field(sa_column=Column(JSON)) # JSONB field for event data
|
| 28 |
+
timestamp: datetime = Field(sa_column=Column(DateTime(timezone=True)), default_factory=lambda: datetime.now(datetime.UTC))
|
| 29 |
|
| 30 |
|
| 31 |
class AuditLogCreate(AuditLogBase):
|