github-actions[bot]
Automated Deploy: 0d5b759d8eca219a25b3ab717925e73a66bbf4a4
2756f0f
Raw History Blame Contribute Delete
781 Bytes
import uuid
from sqlalchemy import ForeignKey, SmallInteger, String
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.orm import Mapped, mapped_column
from app.common.base_model import Base, CreatedAtMixin
class IdempotencyKey(CreatedAtMixin, Base):
"""Stored response for a retried write (Idempotency-Key header)."""
__tablename__ = "idempotency_keys"
account_id: Mapped[uuid.UUID] = mapped_column(
UUID(as_uuid=True), ForeignKey("accounts.id", ondelete="CASCADE"), primary_key=True
)
key: Mapped[str] = mapped_column(String(128), primary_key=True)
request_hash: Mapped[str] = mapped_column(String(64))
response_status: Mapped[int] = mapped_column(SmallInteger)
response_body: Mapped[dict] = mapped_column(JSONB)