Skip to content

feat: implement cursor-based pagination across list endpoints#462

Merged
RUKAYAT-CODER merged 1 commit intoEarnQuestOne:mainfrom
Thosine-01:feat/cursor-pagination
Apr 29, 2026
Merged

feat: implement cursor-based pagination across list endpoints#462
RUKAYAT-CODER merged 1 commit intoEarnQuestOne:mainfrom
Thosine-01:feat/cursor-pagination

Conversation

@Thosine-01
Copy link
Copy Markdown
Contributor

@Thosine-01 Thosine-01 commented Apr 29, 2026

Summary

Implements cursor-based pagination across list endpoints to prevent full-table scans on large datasets and improve API scalability.

Changes

New files

  • src/common/dto/pagination.dto.ts — reusable cursor pagination DTO
  • src/modules/submissions/dto/query-submission.dto.ts — submissions pagination query DTO
  • BackEnd\src\database\migrations\1746000000000-add-cursor-pagination-indexes.ts
  • BackEnd\test\pagination\cursor-pagination.e2e-spec.ts

Updated files

  • src/modules/quests/* — updated quest list endpoints and services for cursor pagination
  • src/modules/users/* — updated leaderboard pagination logic
  • src/modules/submissions/submissions.controller.ts
  • src/modules/submissions/submissions.service.ts
  • src/modules/payouts/payouts.controller.ts
  • src/modules/payouts/payouts.service.ts
  • src/modules/payouts/dto/payout-query.dto.ts
  • src/modules/notifications/notifications.service.ts

Pagination updates

  • Replaced page/limit pagination with cursor-based pagination
  • Added cursor and limit query support
  • Standardized paginated responses with:
    • total
    • limit
    • nextCursor
  • Updated Swagger decorators and API query documentation
  • Refactored service-layer list queries to support cursor traversal

Performance improvements

  • Optimized list queries using createdAt DESC
  • Reduced risk of full-table scans on large datasets
  • Prepared services for indexed cursor lookups

Notes

Database index migration and pagination e2e tests are still pending and will be added in a follow-up PR.

Breaking changes

  • Page-based pagination (page) has been replaced with cursor-based pagination (cursor) on list endpoints.
  • Response structure now returns nextCursor instead of page and totalPages.

close #245

@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

kindly resolve conflict

@Thosine-01 Thosine-01 force-pushed the feat/cursor-pagination branch from 31d0d67 to 2d01255 Compare April 29, 2026 12:23
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 29, 2026

@Thosine-01 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! 🚀

Learn more about application limits

@RUKAYAT-CODER RUKAYAT-CODER merged commit 62bb15f into EarnQuestOne:main Apr 29, 2026
0 of 9 checks passed
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.

Pagination Implementation

2 participants