Add Phase 11B client aware multi bank ownership and engagement archive

This commit is contained in:
A R R R Associates
2026-08-22 20:45:36 +05:30
parent 8748ee9539
commit 016299cf0c
9 changed files with 714 additions and 8 deletions
@@ -17,6 +17,16 @@ class BankStatementAnalysisJob(CommonBase):
user_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True)
role_bucket: Mapped[str] = mapped_column(String(30), nullable=False)
# Phase 11B: optional client-aware analysis. Null preserves the existing
# standalone Work-folder behavior exactly.
client_id: Mapped[int | None] = mapped_column(ForeignKey("clients.id", ondelete="SET NULL"), nullable=True, index=True)
engagement_id: Mapped[int | None] = mapped_column(ForeignKey("client_service_subscriptions.id", ondelete="SET NULL"), nullable=True, index=True)
ownership_confirmation: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
ownership_status: Mapped[str] = mapped_column(String(30), nullable=False, default="not_checked", index=True)
ownership_validation_json: Mapped[str | None] = mapped_column(Text, nullable=True)
engagement_archive_status: Mapped[str] = mapped_column(String(30), nullable=False, default="not_requested", index=True)
engagement_archive_json: Mapped[str | None] = mapped_column(Text, nullable=True)
selected_bank: Mapped[str] = mapped_column(String(40), nullable=False, default="auto")
financial_year: Mapped[str | None] = mapped_column(String(20), nullable=True)
customer_override: Mapped[str | None] = mapped_column(String(255), nullable=True)