api_nonce_his.py 949 B

1234567891011121314151617181920212223
  1. """
  2. API Nonce历史记录模型
  3. """
  4. from datetime import datetime
  5. from app.utils.timezone import beijing_now_naive
  6. from sqlalchemy import Column, Integer, String, DateTime
  7. from app.database import Base
  8. from app.models.history_base import HistoryRecord
  9. class APINonceHis(HistoryRecord):
  10. """API Nonce历史记录表"""
  11. __tablename__ = "api_nonces_his"
  12. id = Column(Integer, primary_key=True, comment="原表主键ID")
  13. nonce = Column(String(128), nullable=False, comment="随机字符串")
  14. endpoint = Column(String(128), nullable=False, comment="接口路径")
  15. session_id = Column(String(64), nullable=True, comment="会话ID")
  16. created_at = Column(DateTime, default=beijing_now_naive, comment="创建时间")
  17. expires_at = Column(DateTime, nullable=False, comment="过期时间")
  18. def __repr__(self):
  19. return f"<APINonceHis(id={self.id}, nonce='{self.nonce}', his_operation='{self.his_operation}')>"