Skip to content

feat(api): add shared pagination helper and creator sort parser#23

Merged
Chucks1093 merged 4 commits into
accesslayerorg:mainfrom
Gbangbolaoluwagbemiga:main
Mar 25, 2026
Merged

feat(api): add shared pagination helper and creator sort parser#23
Chucks1093 merged 4 commits into
accesslayerorg:mainfrom
Gbangbolaoluwagbemiga:main

Conversation

@Gbangbolaoluwagbemiga

Copy link
Copy Markdown
Contributor

This PR implements shared pagination helpers and a creator-specific sort option parser to ensure consistent API responses and safe, validated sorting for the creator listing endpoint.

Key Changes
Shared Pagination Infrastructure:

Added

PaginationMetadata
and

PaginatedResponse
interfaces to

src/utils/api-response.utils.ts
.
Implemented

sendPaginatedSuccess
helper for standardized paginated responses across the API.
Creator Sort Option Parser:

Created

src/modules/creator/creator.utils.ts
with a

parseCreatorSortOptions
function.
Validates allowed sort fields (handle, displayName, createdAt) and directions (asc, desc).
Falls back to safe defaults (createdAt: desc) for invalid or missing inputs.
New Creator Module:

Service: Implemented paginated Prisma queries with dynamic ordering.
Controller: Added logic to parse query parameters and return formatted paginated responses.
Routes: Exposed GET /api/v1/creators.
Configuration:

Registered the creator router in the main API router (

src/modules/index.ts
).
Updated

tsconfig.json
to include es2017 and dom libraries to resolve type errors for Array.includes and console.
Verification
Verified that the sort parser correctly rejects unsupported keys.
Confirmed pagination metadata (total pages, next/prev flags) is calculated accurately.
Ensured the response shape matches the requirements for both data and metadata inclusion.
Issues Addressed
Closes #18
Closes #20
Closes #11
Closes #22

@drips-wave

drips-wave Bot commented Mar 25, 2026

Copy link
Copy Markdown

@Gbangbolaoluwagbemiga 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

@Chucks1093 Chucks1093 merged commit 03bd659 into accesslayerorg:main Mar 25, 2026
1 check 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

2 participants