feat: close autonomous operations for blocked products
This commit is contained in:
@@ -250,6 +250,30 @@ class Job(Base):
|
||||
error: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
|
||||
|
||||
class BlockedProduct(Base):
|
||||
"""Deduplicated safe exception for one tenant/product/field/input."""
|
||||
__tablename__ = "blocked_products"
|
||||
__table_args__ = (UniqueConstraint("blocker_fingerprint", name="uq_blocked_product_fingerprint"),)
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
tenant_id: Mapped[int] = mapped_column(ForeignKey("tenants.id"), index=True)
|
||||
company: Mapped[str] = mapped_column(String(128), index=True)
|
||||
product_code: Mapped[str] = mapped_column(String(64), index=True)
|
||||
gtin: Mapped[str | None] = mapped_column(String(16), nullable=True, index=True)
|
||||
description: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
blocker_type: Mapped[str] = mapped_column(String(48), index=True)
|
||||
field: Mapped[str] = mapped_column(String(64), index=True)
|
||||
reason_code: Mapped[str] = mapped_column(String(96))
|
||||
evidence_summary: Mapped[dict] = mapped_column(JSON, default=dict)
|
||||
input_fingerprint: Mapped[str] = mapped_column(String(64), index=True)
|
||||
blocker_fingerprint: Mapped[str] = mapped_column(String(64))
|
||||
first_seen_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
last_seen_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
retry_count: Mapped[int] = mapped_column(Integer, default=0, server_default="0")
|
||||
next_retry_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
resolved_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
resolution_source: Mapped[str | None] = mapped_column(String(48), nullable=True)
|
||||
|
||||
|
||||
class ClassificationRequest(Base):
|
||||
__tablename__ = "classification_requests"
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
|
||||
Reference in New Issue
Block a user