ifixkart-backend/Backend/app/models/WebhookReceiptModel.py

20 lines
845 B
Python

import ulid
from sqlalchemy import Column, String, DateTime, Boolean, Text, Index
from sqlalchemy.sql import func
from app.core.database.db_session import Base
class WebhookReceipt(Base):
__tablename__ = "webhook_receipts"
receipt_id = Column(String(26), primary_key=True, default=lambda: str(ulid.new()))
provider = Column(String(32), nullable=False, default="RAZORPAY")
event_key = Column(String(128), nullable=False, unique=True, index=True)
signature_valid = Column(Boolean, default=False)
payload_json = Column(Text, nullable=True)
processing_result = Column(String(64), nullable=True)
processed_at = Column(DateTime, nullable=True)
created_at = Column(DateTime, server_default=func.now(), index=True)
__table_args__ = (
Index('idx_webhook_provider_event', 'provider', 'event_key'),
)