fix timezone bug

This commit is contained in:
beabigegg
2025-09-21 11:37:39 +08:00
parent a408ce402d
commit 2a0b29402f
22 changed files with 1050 additions and 519 deletions

View File

@@ -1,6 +1,7 @@
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
from datetime import datetime
from utils.timezone import taiwan_now
db = SQLAlchemy()
@@ -53,7 +54,7 @@ class SpecHistory(db.Model):
user_id = db.Column(db.Integer, db.ForeignKey('ts_user.id', ondelete='SET NULL'), nullable=True)
action = db.Column(db.String(50), nullable=False)
details = db.Column(db.Text, nullable=True)
timestamp = db.Column(db.DateTime, default=datetime.utcnow)
timestamp = db.Column(db.DateTime, default=taiwan_now)
# 建立與 User 和 TempSpec 的關聯,方便查詢
user = db.relationship('User')