feat: added Pagination standard (cursor vs offset)#247
Merged
aji70 merged 3 commits intoMyFanss:mainfrom Feb 25, 2026
Merged
Conversation
aji70
requested changes
Feb 25, 2026
Contributor
aji70
left a comment
There was a problem hiding this comment.
you have some errors and the cli is failing please check and resolve
# Conflicts: # frontend/src/components/earnings/TransactionHistory.tsx # myfans-backend/src/posts/posts.service.ts
Contributor
|
@okekefrancis112 cli is failing |
Contributor
Author
|
all pass now, @aji70 |
Contributor
Author
what errors exactly, please can you point me to them. you can message me on whatsapp: +2349034781941 |
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.
Summary
This PR standardizes all list/collection API endpoints across both
myfans-backend/andbackend/to use consistent offset/page-based pagination, resolving #217. A shared pagination infrastructure was introduced inmyfans-backend/—PaginationQueryDto(query params:pagedefault 1,limitdefault 20) and a genericPaginatedResponseDto<T>(response shape:items,total,page,limit,total_pages) — along with stateless TypeORM helpers (paginate()for QueryBuilder,createPaginatedResponse()for.findAndCount()results). Six existing modules (creators, posts, comments, messages, earnings, subscriptions) were refactored to extend the shared base DTO and return the standardized response wrapper, eliminating per-module duplication of pagination logic. A newGET /subscriptionslist endpoint was added tomyfans-backend/with status filtering and creator relation loading. Inbackend/, the subscriptions service was updated from returning a plain array to a paginated response with a requiredfanquery param. The earnings module was migrated from rawoffset/limitto page-based pagination, with a coordinated frontend update inearnings-api.tsandTransactionHistory.tsxreplacing offset state with page-based navigation and proper "Showing X-Y of Z" display. The conversations list endpoint was changed from returning an unpaginated array to a paginated response using.findAndCount()withskip/take. Each backend preserves its existing naming convention (snake_caseformyfans-backend/,camelCaseforbackend/) to avoid breaking unrelated consumers.Breaking Changes
GET /earnings/transactionsandGET /earnings/withdrawalsnow acceptpage/limitquery params instead ofoffset/limit, and return a paginated envelope ({ items, total, page, limit, total_pages }) instead of a plain array. Frontend updated in this PR.GET /conversations/:id/messagesresponse key changed frommessagestoitems, with added pagination metadata (total,page,limit,total_pages).GET /conversationsnow returns a paginated envelope instead of a plain array.Closes: #217