Files
ewoooc/database/ppt_reports.py
ogt e611702bb9 refactor: unify 4 isolated SQLAlchemy Base instances to database.models.Base
- database/import_models.py: 移除 ext.declarative.declarative_base,改用 from database.models import Base
- database/notification_models.py: 同上
- database/ppt_reports.py: 移除 orm.declarative_base,改用共用 Base
- database/vendor_models.py: 同上
- database/manager.py: 加入 4 個模型的 noqa import,確保 Base.metadata 完整管理所有資料表

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 21:27:20 +08:00

27 lines
1011 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
PPT 簡報資料庫持久化模型
用於儲存生成的簡報,避免重複計算
"""
from sqlalchemy import Column, Integer, String, DateTime, Text, Float
from database.models import Base
from datetime import datetime
class PPTReport(Base):
"""PPT 簡報記錄表"""
__tablename__ = 'ppt_reports'
id = Column(Integer, primary_key=True)
report_type = Column(String(50), nullable=False, index=True) # growth/vendor/bcg
parameters = Column(Text) # JSON 字串,記錄查詢參數
file_path = Column(String(500)) # 生成檔案路徑
file_size = Column(Integer) # 檔案大小
generated_at = Column(DateTime, default=datetime.now, index=True)
expires_at = Column(DateTime, index=True) # 過期時間
# 資料快取JSON 字串)
cached_data = Column(Text) # 儲存查詢結果,避免重複計算
def __repr__(self):
return f"<PPTReport(type={self.report_type}, params={self.parameters}, generated_at={self.generated_at})>"