Skip to content

Add pagination and sorting to GET /v1/communities/:communityId/members #259

Description

@Lakes41

Difficulty: Intermediate
Type: feature

Background
The admin member-listing endpoint GET /v1/communities/:communityId/members is one of the four MVP endpoints documented in the README, intended for admin use.

Problem
As currently documented, the endpoint returns member listings with no visible pagination or sort parameters, which will not scale for communities with many members and risks large, slow responses.

Expected outcome
The endpoint accepts page/pageSize (or cursor-based cursor/limit) query params plus a sort param (e.g., joinedAt, role), returns a paginated envelope (data, total, nextCursor), and the OpenAPI spec is regenerated to reflect the new params.

Suggested implementation

  • Update the Fastify route schema in apps/access-api for this endpoint to accept pagination/sort query params with Zod/JSON-schema validation.
  • Update the Prisma query to use skip/take or cursor-based pagination against the members/memberships tables.
  • Add a paginated response type to packages/shared-types.
  • Run npm run -w access-api openapi:generate and commit the updated docs/openapi.json.
  • Add/extend packages/sdk-lite to pass through the new params.

Acceptance criteria

  • Endpoint supports pagination and returns total count
  • Default page size is reasonable (e.g., 25) and capped (e.g., max 100)
  • docs/openapi.json reflects the new query params
  • sdk-lite exposes the new params in its client method
  • Existing tests updated, new tests added for pagination boundaries

Likely affected files/directories

  • apps/access-api/src/routes/ (community members route)
  • packages/shared-types/
  • packages/sdk-lite/
  • docs/openapi.json

Metadata

Metadata

Labels

GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewardsfeatureNew feature, enhancement, or functional additionintermediateIntermediate difficulty tasks requiring solid experience and some context

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions