Pose, replay, and conflict stay on an injected transport with local retry evidence. Notification receipts keep only memo id, question, class, and submitter, and a resolve conflict stays readable. Assistant: grok Assistant-Session: 01a10329-31cb-78d3-b7a3-789e1fb83139
37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import DateTime, ForeignKey, String, func
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from api.models.base import Base
|
|
|
|
|
|
class MemoNotificationReceipt(Base):
|
|
"""Durable receipt for one informed-decision delivery id.
|
|
|
|
The delivery id is the sender's stable idempotency key. The body is only
|
|
memo id, question, class, and submitter. Rows are retained, not expired.
|
|
"""
|
|
|
|
__tablename__ = "memo_notification_receipts"
|
|
|
|
delivery_id: Mapped[str] = mapped_column(String(128), primary_key=True)
|
|
body_digest: Mapped[str] = mapped_column(String(64), nullable=False)
|
|
memo_id: Mapped[str] = mapped_column(String(63), nullable=False)
|
|
question: Mapped[str] = mapped_column(String(400), nullable=False)
|
|
memo_class: Mapped[str] = mapped_column(String(63), nullable=False)
|
|
submitter: Mapped[str] = mapped_column(String(63), nullable=False)
|
|
message_id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True),
|
|
ForeignKey("agent_messages.id", ondelete="RESTRICT"),
|
|
nullable=False,
|
|
index=True,
|
|
)
|
|
authoritative_review: Mapped[str] = mapped_column(
|
|
String(40), nullable=False, default="signed-in-overview"
|
|
)
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), server_default=func.now(), nullable=False
|
|
)
|