feat: per-user audit endpoint (#325) - #754
Merged
greatest0fallt1me merged 1 commit intoJul 29, 2026
Merged
Conversation
|
@Delightech28 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! 🚀 |
Contributor
|
Great work — merged. 🚀 |
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.
feat: add GET /api/audit/user/:addr per-user audit history endpoint (#325)
Summary
Implements per-user audit history for the GrantFox FWC26 campaign.
Adds
GET /api/audit/user/:addrwhich returns a paginated, cursor-basedlist of audit log entries scoped to a single Stellar wallet address.
Changes
New files
src/routes/audit/user.ts— route handler (factory pattern, matchesexisting audit sub-route conventions)
src/__tests__/routes/auditUser.test.ts— 22 unit tests; all DB andauth dependencies mocked via jest
docs/user-audit-api.md— API reference documentationModified files
src/repositories/auditLogRepo.ts— addedgetAuditLogsByUser();dedicated function that always pins the
walletAddresspredicate so itcannot be accidentally omitted by callers
src/index.ts— registereduserAuditRouterat/api/audit/useropenapi.yaml— addedAuditLogEntryandUserAuditPagecomponentschemas; full
/api/audit/user/{addr}path entry with response examplesEndpoint contract
Query params:
cursor,limit(1–100, default 20),action,startDate,endDateResponse:
{ "data": [...], "nextCursor": "eyJ..." | null }Pagination uses the same
(created_at DESC, id DESC)keyset cursor asGET /api/admin/audit. Seedocs/audit-log-pagination.md.Security
requireAuth— 401 on missing/invalid JWTforbidden attempt is logged at warn level with caller + requested address
:addrvalidated againstG[A-Z2-7]{55}before any DB access — badaddresses never reach the query layer
.strict()— unknown params rejected with 422Test coverage
22 tests across:
returned, cursor forwarded)
valid)
values)
admin cross-address → 200, unauthenticated → 401)
user_audit_forbidden warning emitted)
Checklist
Closes #325