from sqlalchemy import BigInteger, String from sqlalchemy.dialects.mysql import LONGTEXT from sqlalchemy.orm import Mapped, mapped_column from alien_database.base import Base, AuditMixin class ContractEvent(Base, AuditMixin): """合同事件""" __tablename__ = "contract_event" id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True, comment="事件唯一标识") bundle_id: Mapped[int | None] = mapped_column(BigInteger, nullable=True, comment="关联合同包ID") document_id: Mapped[int | None] = mapped_column(BigInteger, nullable=True, comment="关联合同文档ID") sign_flow_id: Mapped[str] = mapped_column(String(64), index=True, comment="e签宝签署流程ID") event_type: Mapped[str] = mapped_column(String(50), comment="事件类型(esign_callback:{action})") payload_json: Mapped[str] = mapped_column(LONGTEXT, comment="e签宝回调原始JSON报文")