Skip to content

feat: Add pagination to list endpoints (closes #63) - #73

Open
senmalong wants to merge 1 commit into
MergeFi:mainfrom
senmalong:feature/add-pagination-to-list-endpoints
Open

feat: Add pagination to list endpoints (closes #63)#73
senmalong wants to merge 1 commit into
MergeFi:mainfrom
senmalong:feature/add-pagination-to-list-endpoints

Conversation

@senmalong

Copy link
Copy Markdown

Overview

This PR implements standard limit/offset pagination for the four primary list endpoints that were returning unbounded result sets:

  • GET /bounties
  • GET /milestones
  • GET /maintenance-pools
  • GET /users

Changes

Core Implementation

  • Added with default page size of 50 and enforced maximum of 100
  • Added wrapper with comprehensive metadata
  • Updated all four services to use with / parameters
  • Updated all four controllers to accept pagination query parameters
  • Results ordered by for consistent pagination

Response Format

{
  "data": [...],
  "meta": {
    "page": 1,
    "limit": 50,
    "totalItems": 250,
    "totalPages": 5,
    "hasNextPage": true,
    "hasPreviousPage": false
  }
}

Testing

  • Added comprehensive e2e test suite ()
  • Tests verify default page size enforcement
  • Tests verify maximum page size cannot be bypassed
  • Tests verify pagination metadata accuracy
  • Tests verify filtering (e.g., bounty status) works with pagination

Acceptance Criteria Met

✅ All four endpoints accept and apply limit/offset parameters
✅ Enforced maximum page size of 100 that cannot be bypassed
✅ Comprehensive tests prove pagination caps large result sets
✅ Backward compatible - pagination parameters optional with defaults

Related Issues

Closes #63

Notes

  • This is distinct from N+1 query issues (separate concern)
  • Default page size of 50 balances performance and usability
  • Maximum of 100 prevents abuse while allowing reasonable batch sizes
  • Pagination metadata enables proper client-side pagination UI

Ready for review!

- Add standard limit/offset pagination to GET /bounties, /milestones, /maintenance-pools, and /users
- Implement PaginationQueryDto with default page size of 50 and enforced maximum of 100
- Return paginated responses with metadata (page, limit, totalItems, totalPages, hasNextPage, hasPreviousPage)
- Add comprehensive e2e tests verifying pagination behavior across all four endpoints
- Ensure backward compatibility by making pagination parameters optional with sensible defaults
- Order results by createdAt DESC for consistent pagination

This resolves the unbounded query issue where list endpoints returned entire tables
in a single response, preventing performance degradation as the platform scales.
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

@senmalong is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bounty/Milestone/MaintenancePool/User list endpoints have no pagination and return the entire table in one unbounded response

1 participant