Pagination helpers for list endpoints#224
Merged
Baskarayelu merged 4 commits intoRemitwise-Org:mainfrom Feb 25, 2026
Merged
Conversation
…into Pagination-Helpers-for-List-Endpoints
Contributor
|
resolve the conflicts |
Contributor
Author
|
conflict resolved @Baskarayelu |
Contributor
|
@shamoo53 please resolve the conflicts |
Contributor
Author
|
conflict resolved @Baskarayelu |
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.
I have successfully implemented standardized pagination for the list endpoints as requested. Here's a summary of the changes made:
Implementation Summary
Created lib/utils/pagination.ts with:
PaginationParams interface for limit/cursor parameters
PaginatedResult interface for standardized response shape
validatePaginationParams() function to validate and sanitize inputs
createPaginatedResponse() function to format responses
paginateData() function for in-memory pagination
Implemented three API endpoints with standardized pagination:
/api/goals
GET endpoint with limit/cursor pagination
Response includes data array, nextCursor, and hasMore flag
Mock data structure for goals with proper typing
/api/bills
GET endpoint with limit/cursor pagination
Response includes data array, nextCursor, and hasMore flag
Mock data structure for bills with proper typing
/api/remittance/history
GET endpoint with limit/cursor pagination
Response includes data array, nextCursor, and hasMore flag
Mock data structure for transactions with proper typing
Created docs/openapi.json with comprehensive API specification:
Detailed endpoints for goals, bills, and transaction history
Parameter definitions for limit and cursor
Response schemas for paginated results
Proper error handling documentation
Updated README.md with:
Explanation of pagination parameters
Response shape documentation
List of available endpoints
Usage examples
Features Implemented
✅ Standardized Query Params: limit (default 20, max 100) and cursor (optional)
✅ Consistent Response Shape: { data: T[], nextCursor?: string, hasMore: boolean }
✅ Multiple Endpoints: /api/goals, /api/bills, /api/remittance/history
✅ OpenAPI Documentation: Comprehensive API specification
✅ README Documentation: Clear usage instructionsThe implementation follows cursor-based pagination which is efficient for large datasets and provides a consistent experience across all list endpoints. The solution is ready for integration with actual backend services or smart contracts in the future
Closes #185