Tahasaif3 commited on
Commit
621a3cb
·
verified ·
1 Parent(s): 02898ce

Update src/models/audit_log.py

Browse files
Files changed (1) hide show
  1. 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)), default=datetime.utcnow)
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)), default=datetime.utcnow)
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):