Summary
Every paginated endpoint constructs its response envelope (items, next_cursor, has_more) independently. A shared helper should produce a consistent paginated response shape so all endpoints return the same structure.
Scope
- Add
buildPaginatedResponse<T>(items: T[], limit: number, cursorFn: (item: T) => string): PaginatedResponse<T>
- If
items.length > limit, set has_more: true, pop the extra item, and set next_cursor to the cursor of the last kept item
- If
items.length <= limit, set has_more: false and next_cursor: null
- Add unit tests for: exact limit, over limit, under limit, empty result set
Acceptance Criteria
ETA: 12 hours
Coordinate on Telegram
Summary
Every paginated endpoint constructs its response envelope (items, next_cursor, has_more) independently. A shared helper should produce a consistent paginated response shape so all endpoints return the same structure.
Scope
buildPaginatedResponse<T>(items: T[], limit: number, cursorFn: (item: T) => string): PaginatedResponse<T>items.length > limit, sethas_more: true, pop the extra item, and setnext_cursorto the cursor of the last kept itemitems.length <= limit, sethas_more: falseandnext_cursor: nullAcceptance Criteria
has_more: trueand cursor set when results exceed limithas_more: falseand cursor null when results at or below limithas_more: false, empty items, null cursorETA: 12 hours
Coordinate on Telegram