fix: add UTC timezone indicator to all datetime serialization
Database stores times in UTC but serialized without timezone info, causing frontend to misinterpret as local time. Now all datetime fields include 'Z' suffix to indicate UTC, enabling proper timezone conversion in the browser. - Add UTCDatetimeBaseModel base class for Pydantic schemas - Update model to_dict() methods to append 'Z' suffix - Affects: tasks, users, sessions, audit logs, translations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,7 +67,10 @@ class TranslationLog(Base):
|
||||
return f"<TranslationLog(id={self.id}, task_id='{self.task_id}', target_lang='{self.target_lang}', tokens={self.total_tokens})>"
|
||||
|
||||
def to_dict(self):
|
||||
"""Convert translation log to dictionary"""
|
||||
"""Convert translation log to dictionary.
|
||||
|
||||
All datetime fields are serialized with 'Z' suffix to indicate UTC timezone.
|
||||
"""
|
||||
return {
|
||||
"id": self.id,
|
||||
"user_id": self.user_id,
|
||||
@@ -83,5 +86,5 @@ class TranslationLog(Base):
|
||||
"estimated_cost": self.estimated_cost,
|
||||
"processing_time_seconds": self.processing_time_seconds,
|
||||
"provider": self.provider,
|
||||
"created_at": self.created_at.isoformat() if self.created_at else None
|
||||
"created_at": self.created_at.isoformat() + 'Z' if self.created_at else None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user