import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, Index } from 'typeorm'; /** * Idempotency table — tracks Redis Stream message IDs that have been processed. * Prevents double-processing on retries. */ @Entity({ name: 'referral_processed_events', schema: 'public' }) export class ProcessedEvent { @PrimaryGeneratedColumn('uuid') id!: string; @Column({ name: 'event_id', type: 'varchar', length: 255, unique: true }) @Index() eventId!: string; @Column({ name: 'event_type', type: 'varchar', length: 100 }) eventType!: string; @CreateDateColumn({ name: 'processed_at', type: 'timestamptz' }) processedAt!: Date; }