Summary
Cursor pagination is implemented independently in each list endpoint with slightly different sort field handling. A generic paginateQuery<T>(model, where, orderBy, cursorField, limit, cursor?) helper should centralise the pattern and guarantee consistent cursor behaviour across all list endpoints.
Scope
- Add
paginateQuery accepting a Prisma model delegate, where clause, orderBy, cursor field name, limit, and optional decoded cursor value
- Returns
{ items: T[], nextCursor: string | null, hasMore: boolean }
- Encode the cursor as base64 of
JSON.stringify({ field, value }) for opacity
- Add unit tests: first page with no cursor, subsequent page using returned cursor, last page returns
hasMore: false and nextCursor: null
- Replace inline pagination logic in at least two existing list endpoints with the helper
Acceptance Criteria
ETA: 12 hours
Coordinate on Telegram
Summary
Cursor pagination is implemented independently in each list endpoint with slightly different sort field handling. A generic
paginateQuery<T>(model, where, orderBy, cursorField, limit, cursor?)helper should centralise the pattern and guarantee consistent cursor behaviour across all list endpoints.Scope
paginateQueryaccepting a Prisma model delegate, where clause, orderBy, cursor field name, limit, and optional decoded cursor value{ items: T[], nextCursor: string | null, hasMore: boolean }JSON.stringify({ field, value })for opacityhasMore: falseandnextCursor: nullAcceptance Criteria
hasMore: falseandnextCursor: nullETA: 12 hours
Coordinate on Telegram