fix(#170): add server-side pagination to GET /bounties endpoint#285
Merged
Xuccessor merged 1 commit intoJun 20, 2026
Merged
Conversation
…ndpoint Backend: - New generic PaginationQueryDto + PaginatedResponse<T> + toSkip/toTotalPages helpers in apps/backend/src/common/pagination.dto.ts (reusable for other paginated endpoints) - BountiesService.findAll() now accepts PaginationQueryDto and returns PaginatedResponse<Bounty> using findAndCount + skip/take - BountiesController.findAll() exposes @query() pagination: PaginationQueryDto with default page=1, limit=20, max limit=100 (validated by class-validator) - Swagger schema updated for paginated response Frontend (apps/frontend/app/page.tsx): - getBounties() now passes page+limit and reads {data, total, page, pageSize, totalPages}; keeps the bare-array fallback from BountyOnChain#150 - New PaginationControls component (Previous / page-of-totalPages / Next) that preserves all current filters in the URL via buildPageHref - Showing N of total + page indicator with friendly 1-based numbering Tests: - apps/backend/src/common/pagination.dto.spec.ts: DTO validation + math helpers + PaginatedResponse.of (10 cases) - apps/backend/src/bounties.service.spec.ts: findAll() suite covering defaults, custom skip/take, and the empty-total edge case All 124 backend tests pass, npx tsc --noEmit clean.
8738717 to
1bc989a
Compare
Contributor
Author
|
Hey 👋 Quick nudge on this one — the pagination work is complete and CI is green on the fork. Summary of #285:
Verification:
Happy to split into smaller commits if maintainer prefers — just let me know. Otherwise ready for review when you have a moment. Closes #170 |
Contributor
|
Hey 👋 Server-side pagination is essential for scaling this endpoint. Merging. 🚀 |
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 #170
Summary
Server-side pagination for
GET /api/v1/bountieswith reusable backend helpers + frontend UI.Backend (apps/backend)
common/pagination.dto.ts: genericPaginationQueryDto(page, limit with @Min/@max) +PaginatedResponse<T>+toSkip/toTotalPageshelpers (reusable for any future paginated endpoint).BountiesService.findAll(): now acceptsPaginationQueryDto, returnsPaginatedResponse<Bounty>usingfindAndCount+skip/take.BountiesController.findAll(): accepts@Query() pagination: PaginationQueryDto. Defaults: page=1, limit=20, max=100.Frontend (apps/frontend/app/page.tsx)
getBounties(page, limit)now requests?page=\&limit=and reads{data, total, page, pageSize, totalPages}. Bare-array fallback from fix(#75): add paginated bounty responses #150 is preserved for safety.PaginationControlscomponent (Previous / page X of Y / Next) that preserves all current filter params viabuildPageHref.Tests
common/pagination.dto.spec.ts(10 cases): DTO coercion + validation + math helpers +PaginatedResponse.of.bounties.service.spec.ts: newfindAlldescribe block covering defaults, custom skip/take, and empty-total edge case.Verification
npx tsc --noEmit -p tsconfig.jsoncleannpx jest→ 124/124 tests pass (added 22 new tests)GET /bountiesacceptspage+limit(default 1 / 20, max 100)data,total,page,pageSize,totalPagesfindAndCountwithskip/take(server-side)