feat: add event-driven audit logging#7
Conversation
- Add @nestjs/event-emitter for domain events - Create domain events (EntityCreated, EntityUpdated, EntityDeleted, UserLogin, UserLogout) - Add AuditListener to handle events and create audit logs - Keep TypeORM subscriber for backwards compatibility - Event-driven approach provides explicit dependencies and richer context 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add domain-events.spec.ts with 22 tests covering: - EntityCreatedEvent, EntityUpdatedEvent, EntityDeletedEvent - UserLoginEvent, UserLogoutEvent - RequestContext and ActorContext interfaces - Add audit.listener.spec.ts with 13 tests covering: - Event handlers for all domain events - Audit log creation with proper transaction types - Error handling (non-throwing on failures) - Add audit.subscriber.spec.ts with 9 tests covering: - TypeORM subscriber hooks (afterInsert, afterUpdate, afterRemove) - AuditLog entity skipping (prevents recursive auditing) - CLS context integration - Add Jest moduleNameMapper for src/* path resolution 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Rate limit exceeded@aabrius has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 28 minutes and 2 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (10)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Test plan
npm test -- --testPathPattern="domain-events|audit.listener|audit.subscriber"to verify all tests pass🤖 Generated with Claude Code