- Use Prisma $transaction with Serializable isolation level - Insert idempotency record FIRST, then execute business logic - Unique constraint violation (P2002) indicates duplicate event - All operations atomic - either fully commit or fully rollback - Modified all handlers to accept transaction client parameter - Removed old non-atomic isEventProcessed/recordProcessedEvent methods This ensures 100% data consistency for CDC synchronization, which is critical for financial data where any error is catastrophic. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| api | ||
| application | ||
| infrastructure | ||
| shared | ||
| app.module.ts | ||
| main.ts | ||