Skip to content

feat: escrow event sourcing with full audit trail#457

Open
Clinton6801 wants to merge 5 commits into
StayLitCodes:mainfrom
Clinton6801:feat/escrow-event-sourcing
Open

feat: escrow event sourcing with full audit trail#457
Clinton6801 wants to merge 5 commits into
StayLitCodes:mainfrom
Clinton6801:feat/escrow-event-sourcing

Conversation

@Clinton6801

Copy link
Copy Markdown

Summary

Closes #284. Implements a dedicated append-only EscrowEventStore
alongside the existing event system, with 15 event types, replay
capability, and enhanced querying endpoints.

New files

  • enums/escrow-event-type.enum.ts (15 event types)
  • entities/escrow-event-store.entity.ts
  • services/escrow-event-store.service.ts
  • dto/escrow-event-store.dto.ts
  • tests/escrow-event-store.service.spec.ts
  • Migration: CreateEscrowEventStore (with indexes +
    idempotency constraint)

New/enhanced endpoints

  • GET /escrows/:id/events — pagination + type filter added
  • GET /escrows/:id/timeline — human-readable reconstruction
  • GET /events — global stream (admin, filterable by actor/type/date)
  • POST /admin/escrows/:id/replay-events — state replay +
    inconsistency detection

Acceptance criteria

✅ Append-only (INSERT only, update()/delete() throw 403)
✅ Idempotency key deduplication on (escrowId, idempotencyKey)
✅ Monotonic version per escrow
✅ All 15 event types
✅ Timeline with human-readable descriptions
✅ Replay detects status inconsistencies
✅ Old escrow_events table untouched
✅ All 8 tests pass

closes #284

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Clinton6801 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] Escrow Event Sourcing with Full Audit Trail

2 participants