""" 找回密码工单模型 """ from datetime import datetime from sqlalchemy import Column, Integer, String, DateTime, ForeignKey from app.database import Base from app.utils.timezone import beijing_now_naive class PasswordResetRequest(Base): """找回密码工单表""" __tablename__ = "password_reset_requests" id = Column(Integer, primary_key=True, autoincrement=True, comment="主键ID") user_id = Column(Integer, ForeignKey("users.id"), nullable=False, comment="用户ID") username = Column(String(100), nullable=False, comment="用户名") email = Column(String(255), nullable=False, comment="用户邮箱") status = Column(String(20), nullable=False, default="pending", comment="状态: pending-待处理, processing-处理中, sent-已发送, failed-失败") error_message = Column(String(500), nullable=True, comment="失败时错误信息") created_at = Column(DateTime, default=beijing_now_naive, nullable=False, comment="申请时间") processed_at = Column(DateTime, nullable=True, comment="处理完成时间") def __repr__(self): return f""