Files
group_fqcd_jr/app/model/risk_questionnaire.py
T

31 lines
1.3 KiB
Python

"""Additive projection model for opening-risk questionnaire profiles."""
from datetime import datetime
from typing import Any
from sqlalchemy import JSON, BigInteger, DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.model.base import Base
from app.model.fund import FundRiskAssessment as RiskAssessment
class ProfileSnapshot(Base):
__tablename__ = "profile_snapshots"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
profile_uuid: Mapped[str | None] = mapped_column(String(36), unique=True)
customer_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
version: Mapped[int] = mapped_column(BigInteger, nullable=False)
snapshot: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
generation_basis: Mapped[dict[str, Any] | None] = mapped_column(JSON)
snapshot_hash: Mapped[str | None] = mapped_column(String(64))
is_current: Mapped[bool] = mapped_column(nullable=False, default=False)
current_customer_id: Mapped[int | None] = mapped_column(BigInteger)
generated_at: Mapped[datetime | None] = mapped_column(DateTime)
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
__all__ = ["ProfileSnapshot", "RiskAssessment"]