rwadurian/backend/services/contribution-service/prisma
hailin ff67319171 feat(contribution): implement transactional idempotent CDC consumer for 1.0->2.0 sync
Implements 100% exactly-once semantics for CDC events from 1.0 databases
(identity-service, planting-service, referral-service) to contribution-service.

Key changes:
- Add ProcessedCdcEvent model with (sourceTopic, offset) unique constraint
- Add withIdempotency() wrapper using Serializable transaction isolation
- Add registerTransactionalHandler() for handlers requiring idempotency
- Modify CDC handlers to accept external transaction client
- All database operations now use the passed transaction client

This ensures that:
1. Each CDC event is processed exactly once
2. Idempotency record and business logic are in the same transaction
3. Any failure causes complete rollback

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:22:47 -08:00
..
migrations feat(contribution): implement transactional idempotent CDC consumer for 1.0->2.0 sync 2026-01-12 19:22:47 -08:00
schema.prisma feat(contribution): implement transactional idempotent CDC consumer for 1.0->2.0 sync 2026-01-12 19:22:47 -08:00