refactor(api): standardize cursor-based pagination across list endpoi… - #669
Merged
Topmatrixmor2014 merged 1 commit intoAug 18, 2026
Conversation
🤖 Greptile AI Code ReviewGreptile will automatically review this PR (15 file(s) changed). Review gates:
|
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.
refactor(api): standardize cursor-based pagination across list endpoints (#344)
Summary
Standardizes cursor-based pagination across every list endpoint in the backend with uniform request parameters (
cursor,limitdefault 20, max 100) and canonical response shapes ({ data: [...], pagination: { nextCursor, hasMore, total } }).Type of change
Related issue
Closes #344
Changes
backend/src/utils/paginate.js): AddedformatPaginatedResponse(data, cursor, total, extra)to standardize the payload shape across in-memory and database-backed list queries while preserving RFC 5988Link(rel="next") andX-Total-Countheaders.backend/src/middleware/pagination.js&backend/src/server.js): AppliedpaginationMiddlewareglobally to sanitizelimit(default 20, capped at 100) and parse opaque base64url cursor tokens across all routes.accounts.js,payments.js,paymentController.js): AddedGET /api/v1/accounts/:publicKey/paymentsand updatedGET /api/v1/payments/:publicKeyto return standard paginated envelopes using Horizon paging tokens as cursors.tips.js,tipsController.js,events.js,eventController.js): StandardizedGET /api/v1/tips/received/:creatorPublicKey,GET /api/v1/tips/sent/:senderPublicKey,GET /api/v1/tips/:creatorPublicKey,GET /api/v1/events/:publicKey, andGET /api/v1/events/:publicKey/:eventType.webhooks.js,turrets.js,turretsController.js,scheduledTransactions.js): StandardizedGET /api/v1/webhooks/:publicKey,GET /api/v1/webhooks/:publicKey/events,GET /api/v1/turrets,GET /api/v1/turrets/:id/history,GET /api/v1/scheduled-transactions/:publicKey, andGET /api/v1/scheduled-transactions/:publicKey/pending.docs/api.md): Added a dedicated "Pagination" section detailing parameters, response structures, header definitions, and all supported endpoints.backend/__tests__/pagination.test.js): Added unit tests forformatPaginatedResponseand integration tests validating cursor pagination across all list endpoints.Testing
Screenshots (if UI change)
N/A (Backend API standardization)
Checklist
main