feat(admin): add audit-log viewer with filters, pagination, and export (#768) - #780
Merged
Merged
Conversation
Savitura#768) - Add auditService with append-only log writing, metadata sanitization, filtering (actor, action, resourceType, date range), pagination, and CSV/JSON export - Add /api/admin/audit-logs route (list) and /api/admin/audit-logs/export - Mount audit-logs router under existing /api/admin prefix - Add comprehensive tests for listing, filtering, pagination, and export - Sensitive fields (password, token, secret, etc.) are redacted from metadata
…tura#757) - Add creator_refunds table with status tracking (pending/processing/completed/failed) - Add GET /api/admin/refunds (list with filters and pagination) - Add POST /api/admin/refunds (create refund request) - Add PATCH /api/admin/refunds/:id (update status and tx hash) - Add tests for list, create, and update - Mount under existing /api/admin prefix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #768.
Summary
Adds an admin-facing audit-log API with filtering, pagination, and CSV/JSON export.
Backend changes
services/auditService.js: append-only audit logging with metadata sanitization (passwords/tokens/secrets redacted), query builder with actor/action/resourceType/date filters, and CSV/JSON exportroutes/auditLogs.js:GET /api/admin/audit-logs(list + pagination) andGET /api/admin/audit-logs/export(download)routes/admin.js: mounts audit-logs router under existing/api/adminprefixTests
auditLogs.test.js: covers listing, action filtering, pagination limits/offset, JSON export, CSV exportSecurity
[REDACTED]requireAuth+requireRole(admin)middleware