beardofedu / beardofedu/copilot-cli-fun-times
feat: pagination for GET /tasks
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
Add `limit` and `offset` query parameters to `GET /tasks` so clients can page through large task lists without receiving the full dataset in every response.
## Motivation
The task list is currently returned in full on every request. As the number of tasks grows, this becomes inefficient. Pagination is a standard REST API pattern that improves performance and usability.
## Proposed Behavior
- `GET /tasks?limit=10&offset=0` returns the first 10 tasks
- `GET /tasks?limit=10&offset=10` returns the next 10 tasks
- Default `limit` should be 20; default `offset` should be 0
- Response should include a metadata wrapper: `{ data: [...], total, limit, offset }`
- Pagination is applied after filtering and sorting
- Invalid (non-numeric, negative) values for `limit`/`offset` return HTTP 400
## Acceptance Criteria
- [ ] `GET /tasks?limit=N&offset=M` returns the correct slice of tasks
- [ ] Response body includes `total`, `limit`, and `offset` fields
- [ ] Defaults apply when params are omitted
- [ ] HTTP 400 returned for invalid param values
- [ ] Pagination logic extracted into a utility function in `utils.js`
- [ ] Unit tests written for the pagination utility
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the entry point handling GET /tasks and trace its filtering and sorting flow. Extract the pagination logic into utils.js, then add unit tests for slicing, defaults, totals, and invalid values. Done means the endpoint returns the specified metadata wrapper and HTTP 400 for invalid limit or offset parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100