Skip to content

Add ?page= and ?limit= pagination to GET /tasks #3

Description

@daniel-sarosi-gwc

Goal

Paginate the list endpoint so callers don't have to receive the full list.

Acceptance criteria

  • GET /tasks?limit=10 returns at most 10 tasks.
  • GET /tasks?page=2&limit=10 returns tasks 11–20 (1-indexed pages).
  • Default page=1, default limit=50 (document the choice in code).
  • Out-of-range pages return an empty array, not an error.
  • Reject page=0 and limit=0 with 400 Bad Request.
  • Tests cover: default page, second page, last partial page, page beyond the end.

Branch

feat/issue-3-add-pagination

Files to touch

  • src/handlers.rs — extract Query<Pagination>; return the slice.
  • src/store.rs — add a paginated(page, limit) -> Vec<&Task> helper.
  • tests/integration.rs — at least three new tests.

Suggested commit shape

  • feat: add ?page= and ?limit= pagination to GET /tasks
  • test: cover default, second, partial, and out-of-range pages
  • fix: reject page=0 and limit=0 with 400 Bad Request

Verification

  • cargo test — all tests pass.
  • cargo fmt --check && cargo clippy --all-targets -- -D warnings — clean.

See docs/issues/03-add-pagination.md for the full spec.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions