merge: 并入同事的场外申购/推广/行情/NL2SQL 线(11 提交、334 文件)
冲突仅 3 个文件,全部取并集(双方都没有需要丢弃的改动): - app/main.py:import 双方路由(我方 knowledge_management + 同事的 offsite_fund/ promotion_material);include_router 段本已自动合并 - app/service/agent/bootstrap.py:import 与工具注册均取并集 (query_customer_profile + query_financial_data 都注册) - tests/integration/test_config_release_mysql.py:outbox 清理同时保留 架构师的 event_type 限定(防误删其它域 outbox 行)与同事新增的 peer_release_id 同事这轮带入:11 个 alembic 迁移(建 offsite_* / promotion_* 等表)、 场外申购与推广素材 Agent、financial NL2SQL 工具。 注意:本库尚无 offsite_*/promotion_* 表,跑相关测试前需要执行 alembic upgrade。 边界核对:同事的场外代码未写入场内交易表(fin_sim_order/fin_capital_flow/fin_cash_ledger), 符合 AGENTS.md 规则 8。
This commit is contained in:
@@ -0,0 +1,242 @@
|
||||
"""场外基金运营独立持久化模型。"""
|
||||
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import (
|
||||
JSON,
|
||||
BigInteger,
|
||||
Date,
|
||||
DateTime,
|
||||
Integer,
|
||||
Numeric,
|
||||
String,
|
||||
Text,
|
||||
UniqueConstraint,
|
||||
)
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.model.base import Base
|
||||
|
||||
|
||||
class OffsiteFundMail(Base):
|
||||
__tablename__ = "offsite_fund_mail"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("imap_uid", "message_id", name="uk_offsite_mail_source"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
mail_id: Mapped[str] = mapped_column(String(16), unique=True, nullable=False)
|
||||
imap_uid: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
message_id: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
received_date: Mapped[date] = mapped_column(Date, nullable=False)
|
||||
sender: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
return_path: Mapped[str | None] = mapped_column(String(255))
|
||||
auth_result: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
original_eml_path: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(32), nullable=False, default="received")
|
||||
retry_count: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
last_error: Mapped[str | None] = mapped_column(String(500))
|
||||
next_retry_at: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
last_attempt_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)
|
||||
|
||||
|
||||
class OffsiteMailCursor(Base):
|
||||
"""场外收件箱 UID 游标和处理租约。"""
|
||||
|
||||
__tablename__ = "offsite_mail_cursor"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("mailbox", "folder", name="uk_offsite_mail_cursor_scope"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(
|
||||
BigInteger().with_variant(Integer, "sqlite"), primary_key=True
|
||||
)
|
||||
mailbox: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
folder: Mapped[str] = mapped_column(String(64), nullable=False, default="INBOX")
|
||||
last_uid: Mapped[str] = mapped_column(String(64), nullable=False, default="0")
|
||||
status: Mapped[str] = mapped_column(String(32), nullable=False, default="idle")
|
||||
retry_count: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
blocked_uid: Mapped[str | None] = mapped_column(String(64))
|
||||
blocked_message_id: Mapped[str | None] = mapped_column(String(255))
|
||||
last_error: Mapped[str | None] = mapped_column(String(500))
|
||||
next_retry_at: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
lease_id: Mapped[str | None] = mapped_column(String(64))
|
||||
lease_until: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class OffsiteFundAttachment(Base):
|
||||
__tablename__ = "offsite_fund_attachment"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("file_hash", "mail_id", name="uk_offsite_attachment_hash"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
attachment_id: Mapped[str] = mapped_column(String(24), unique=True, nullable=False)
|
||||
mail_id: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
filename: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
file_hash: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
media_type: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
size_bytes: Mapped[int] = mapped_column(BigInteger, nullable=False, default=0)
|
||||
document_type: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
original_file_path: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
ocr_text: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
extracted_fields: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
field_confidence: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
page_evidence: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(32), nullable=False, default="recognized")
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class OffsiteRecognitionAttempt(Base):
|
||||
"""场外附件每次 OCR/模型识别尝试的不可覆盖记录。"""
|
||||
|
||||
__tablename__ = "offsite_recognition_attempt"
|
||||
|
||||
id: Mapped[int] = mapped_column(
|
||||
BigInteger().with_variant(Integer, "sqlite"), primary_key=True
|
||||
)
|
||||
task_id: Mapped[str | None] = mapped_column(String(24))
|
||||
mail_id: Mapped[str | None] = mapped_column(String(16))
|
||||
attachment_id: Mapped[str | None] = mapped_column(String(24))
|
||||
imap_uid: Mapped[str | None] = mapped_column(String(64))
|
||||
message_id: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
filename: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
file_hash: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
original_file_path: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
attempt_no: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
source: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
operator_id: Mapped[str | None] = mapped_column(String(64))
|
||||
document_type: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
ocr_status: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
llm_status: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
extracted_fields: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
field_confidence: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
missing_fields: Mapped[list[Any]] = mapped_column(JSON, nullable=False)
|
||||
low_confidence_fields: Mapped[list[Any]] = mapped_column(JSON, nullable=False)
|
||||
page_evidence: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
error_message: Mapped[str | None] = mapped_column(String(500))
|
||||
started_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
finished_at: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class OffsiteFieldCorrection(Base):
|
||||
"""场外字段人工修正记录。
|
||||
|
||||
OCR 识别值与 NL2SQL 返回值都属于 Agent 产出,人工修正只能新增一条记录,
|
||||
不覆盖原始值;修正前值、修正后值、变更字段和操作人全部留痕,便于审计对比。
|
||||
"""
|
||||
|
||||
__tablename__ = "offsite_field_correction"
|
||||
|
||||
id: Mapped[int] = mapped_column(
|
||||
BigInteger().with_variant(Integer, "sqlite"), primary_key=True
|
||||
)
|
||||
target_type: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
task_id: Mapped[str | None] = mapped_column(String(24))
|
||||
mail_id: Mapped[str | None] = mapped_column(String(16))
|
||||
attachment_id: Mapped[str | None] = mapped_column(String(24))
|
||||
operator_id: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
original_fields: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
corrected_fields: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
changed_fields: Mapped[list[Any]] = mapped_column(JSON, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class OffsiteFundDocument(Base):
|
||||
__tablename__ = "offsite_fund_document"
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_id: Mapped[str] = mapped_column(String(24), unique=True, nullable=False)
|
||||
mail_id: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
attachment_id: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
document_type: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
fund_code: Mapped[str | None] = mapped_column(String(32))
|
||||
fund_name: Mapped[str | None] = mapped_column(String(255))
|
||||
account_identifier: Mapped[str | None] = mapped_column(String(128))
|
||||
investor_name: Mapped[str | None] = mapped_column(String(128))
|
||||
application_no: Mapped[str | None] = mapped_column(String(128))
|
||||
application_date: Mapped[date | None] = mapped_column(Date)
|
||||
raw_application_date: Mapped[str | None] = mapped_column(String(64))
|
||||
agency: Mapped[str | None] = mapped_column(String(128))
|
||||
subscription_amount_yuan: Mapped[Decimal | None] = mapped_column(Numeric(20, 4))
|
||||
redemption_shares: Mapped[Decimal | None] = mapped_column(Numeric(20, 4))
|
||||
operator_decision: Mapped[str] = mapped_column(String(16), nullable=False, default="未处理")
|
||||
status: Mapped[str] = mapped_column(String(32), nullable=False, default="planned")
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class OffsiteExecutionPlanTask(Base):
|
||||
__tablename__ = "offsite_execution_plan_task"
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_id: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
stage: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
rule_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
title: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
depends_on: Mapped[list[Any]] = mapped_column(JSON, nullable=False)
|
||||
input_json: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
output_json: Mapped[dict[str, Any] | None] = mapped_column(JSON)
|
||||
status: Mapped[str] = mapped_column(String(16), nullable=False, default="待执行")
|
||||
error_message: Mapped[str | None] = mapped_column(String(500))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class OffsiteRuleResult(Base):
|
||||
__tablename__ = "offsite_rule_result"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("task_id", "rule_code", name="uk_offsite_rule_task"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_id: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
rule_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
rule_name: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
result: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
document_value: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
database_value: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
calculation: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class OffsiteQueryRecord(Base):
|
||||
__tablename__ = "offsite_query_record"
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_id: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
rule_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
natural_language_request: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
script_path: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
result_summary: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(24), nullable=False)
|
||||
error_message: Mapped[str | None] = mapped_column(String(500))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class OffsiteNotification(Base):
|
||||
__tablename__ = "offsite_notification"
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
notification_type: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
business_key: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
receiver_id: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
operator_id: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
agent_draft: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
final_content: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
payload: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(16), nullable=False, default="待发送")
|
||||
retry_count: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
provider_message_id: Mapped[str | None] = mapped_column(String(128))
|
||||
failure_reason: Mapped[str | None] = mapped_column(String(500))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
sent_at: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
updated_at: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
@@ -0,0 +1,142 @@
|
||||
"""产品推介材料自动生成独立持久化模型。"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import JSON, BigInteger, DateTime, Integer, String, Text, UniqueConstraint
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.model.base import Base
|
||||
|
||||
|
||||
class PromotionMaterialTask(Base):
|
||||
__tablename__ = "promotion_material_task"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("task_no", name="uk_promotion_task_no"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_no: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
product_code: Mapped[str | None] = mapped_column(String(32))
|
||||
product_name: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
material_title: Mapped[str] = mapped_column(String(200), nullable=False)
|
||||
style_code: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
output_formats: Mapped[list[str]] = mapped_column(JSON, nullable=False)
|
||||
template_version: Mapped[str | None] = mapped_column(String(64))
|
||||
status: Mapped[str] = mapped_column(String(32), nullable=False, default="draft")
|
||||
created_by: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class PromotionInputSnapshot(Base):
|
||||
__tablename__ = "promotion_input_snapshot"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("task_no", "version_no", name="uk_promotion_input_version"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_no: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
version_no: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
product_info: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
manager_info: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
team_info: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
strategy_info: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
fee_structure: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
performance_info: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
risk_disclosure: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
source_notes: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
created_by: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class PromotionAttachment(Base):
|
||||
__tablename__ = "promotion_attachment"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("task_no", "file_hash", name="uk_promotion_attachment_hash"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_no: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
attachment_type: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
filename: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
media_type: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
file_hash: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
size_bytes: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
file_path: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
parsed_metadata: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
uploaded_by: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class PromotionMaterialVersion(Base):
|
||||
__tablename__ = "promotion_material_version"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("task_no", "version_no", name="uk_promotion_material_version"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_no: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
input_snapshot_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
version_no: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
style_code: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
template_version: Mapped[str | None] = mapped_column(String(64))
|
||||
prompt_version: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
draft_json: Mapped[dict[str, Any]] = mapped_column(JSON, nullable=False)
|
||||
pptx_path: Mapped[str | None] = mapped_column(String(500))
|
||||
pdf_path: Mapped[str | None] = mapped_column(String(500))
|
||||
poster_path: Mapped[str | None] = mapped_column(String(500))
|
||||
chart_paths: Mapped[list[str]] = mapped_column(JSON, nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
error_message: Mapped[str | None] = mapped_column(String(500))
|
||||
generated_by: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class PromotionComplianceCheck(Base):
|
||||
__tablename__ = "promotion_compliance_check"
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_no: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
material_version_id: Mapped[int | None] = mapped_column(BigInteger)
|
||||
rule_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
rule_name: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
scope: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
severity: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
hit_text: Mapped[str | None] = mapped_column(Text)
|
||||
suggestion: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class PromotionReviewRecord(Base):
|
||||
__tablename__ = "promotion_review_record"
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_no: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
material_version_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
reviewer_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
decision: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
comment: Mapped[str | None] = mapped_column(String(1000))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
|
||||
|
||||
class PromotionDeliveryRecord(Base):
|
||||
__tablename__ = "promotion_delivery_record"
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"material_version_id",
|
||||
"advisor_id",
|
||||
name="uk_promotion_delivery_version_advisor",
|
||||
),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
task_no: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
material_version_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
advisor_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
delivery_channel: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
status: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
failure_reason: Mapped[str | None] = mapped_column(String(500))
|
||||
created_by: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
||||
sent_at: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
Reference in New Issue
Block a user