Backend - Add admin endpoint to list and filter audit events by actor and type
Description
src/app/api/admin/audit-events/route.ts returns audit events but lacks filtering. Add query support to filter by actor address, event type, and time range using the audit schema in src/lib/backend/auditLog.ts, keeping the endpoint admin-gated.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Filter by actor, type, and time range with validation
- Keep admin gating via
requireAuth.ts
- Reuse
src/lib/backend/pagination.ts
- Redact sensitive fields in responses
Suggested execution
- Fork the repo and create a branch
git checkout -b feature/audit-events-filtering
- Implement changes
- Update
src/app/api/admin/audit-events/route.ts
- Extend
src/app/api/admin/audit-events/route.test.ts
- Update
docs/backend-api-reference.md
- Add filter validation
- Test and commit
- Run tests, cover edge cases
- Include test output and notes
Example commit message
feat: add actor/type/time filtering to audit-events endpoint
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Backend - Add admin endpoint to list and filter audit events by actor and type
Description
src/app/api/admin/audit-events/route.tsreturns audit events but lacks filtering. Add query support to filter by actor address, event type, and time range using the audit schema insrc/lib/backend/auditLog.ts, keeping the endpoint admin-gated.Requirements and context
requireAuth.tssrc/lib/backend/pagination.tsSuggested execution
git checkout -b feature/audit-events-filteringsrc/app/api/admin/audit-events/route.tssrc/app/api/admin/audit-events/route.test.tsdocs/backend-api-reference.mdExample commit message
feat: add actor/type/time filtering to audit-events endpointGuidelines