"""customer_relation 客户-投顾关系表 ORM 模型。""" from __future__ import annotations from datetime import datetime from sqlalchemy import BigInteger, DateTime, String from sqlalchemy.orm import Mapped, mapped_column from model.base import Base class CustomerRelation(Base): """客户与投顾的当前或历史关系。""" __tablename__ = "customer_relation" __table_args__ = {"comment": "客户-投顾关系表"} id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True) customer_id: Mapped[int] = mapped_column(BigInteger, nullable=False) advisor_id: Mapped[int] = mapped_column(BigInteger, nullable=False) assign_time: Mapped[datetime] = mapped_column(DateTime, nullable=False) signed_time: Mapped[datetime | None] = mapped_column(DateTime) end_time: Mapped[datetime | None] = mapped_column(DateTime) status: Mapped[str] = mapped_column(String(16), nullable=False) reason: Mapped[str | None] = mapped_column(String(128))