[PR #5856] feat(organization): Add limit & offset to Teams and Roles #6279

Open
opened 2026-03-13 12:53:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5856
Author: @felixrydberg
Created: 11/8/2025
Status: 🔄 Open

Base: canaryHead: feat/organization-team-roles-pagination


📝 Commits (6)

  • 3ab94c4 feat(organization): Add limit & offset
  • bf9ffd8 fix(organization): format
  • 51adfed Merge branch 'canary' into feat/organization-team-roles-pagination
  • ab00c7d fix(organization):Missed listTeams parameters update
  • ed5f437 Merge branch 'canary' into feat/organization-team-roles-pagination
  • c2d3b30 Merge branch 'canary' into feat/organization-team-roles-pagination

📊 Changes

6 files changed (+402 additions, -6 deletions)

View changed files

📝 docs/content/docs/plugins/organization.mdx (+24 -0)
📝 packages/better-auth/src/plugins/organization/adapter.ts (+15 -3)
📝 packages/better-auth/src/plugins/organization/routes/crud-access-control.test.ts (+55 -0)
📝 packages/better-auth/src/plugins/organization/routes/crud-access-control.ts (+16 -0)
packages/better-auth/src/plugins/organization/routes/crud-team.test.ts (+255 -0)
📝 packages/better-auth/src/plugins/organization/routes/crud-team.ts (+37 -3)

📄 Description

This PR adds pagination support to the organization plugin's team and role listing endpoints. Organization members had a way of doing this already, so this is mostly an extension of that.

Changes Made

  • Added limit and offset query parameters to listTeams endpoint
  • Added limit and offset query parameters to listOrgRoles endpoint
  • Added limit and offset query parameters to listTeamMembers endpoint
  • Added tests for `crud-team.ts
  • Added docs for new query params

If I have missed anything just leave it in the comments and ill get on it :)


Summary by cubic

Adds pagination to organization team, role, and team member listing endpoints using limit and offset to reduce payload size and improve performance. Adapter and routes now pass pagination options; tests and docs included.

  • New Features
    • listTeams, listOrgRoles, and listTeamMembers accept optional limit and offset query params.
    • Adapter methods forward pagination to findMany with no change in behavior when omitted.
    • Added tests for pagination across roles, teams, and team members, and updated docs.

Written for commit c2d3b301fe. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5856 **Author:** [@felixrydberg](https://github.com/felixrydberg) **Created:** 11/8/2025 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `feat/organization-team-roles-pagination` --- ### 📝 Commits (6) - [`3ab94c4`](https://github.com/better-auth/better-auth/commit/3ab94c4bd7a7df18063f14b6cbeabc146930ddf8) feat(organization): Add limit & offset - [`bf9ffd8`](https://github.com/better-auth/better-auth/commit/bf9ffd876214be7c4e526d75977feb6f244300b8) fix(organization): format - [`51adfed`](https://github.com/better-auth/better-auth/commit/51adfed4375df3b72a83d4e3aa8ac42332d18d26) Merge branch 'canary' into feat/organization-team-roles-pagination - [`ab00c7d`](https://github.com/better-auth/better-auth/commit/ab00c7d79f83014a58f61c7cf09e5cade8d3233b) fix(organization):Missed listTeams parameters update - [`ed5f437`](https://github.com/better-auth/better-auth/commit/ed5f437f74177780fafe1168e0f58addefd7c675) Merge branch 'canary' into feat/organization-team-roles-pagination - [`c2d3b30`](https://github.com/better-auth/better-auth/commit/c2d3b301fe0634d3aed662cc62bd3f42e48ae320) Merge branch 'canary' into feat/organization-team-roles-pagination ### 📊 Changes **6 files changed** (+402 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/organization.mdx` (+24 -0) 📝 `packages/better-auth/src/plugins/organization/adapter.ts` (+15 -3) 📝 `packages/better-auth/src/plugins/organization/routes/crud-access-control.test.ts` (+55 -0) 📝 `packages/better-auth/src/plugins/organization/routes/crud-access-control.ts` (+16 -0) ➕ `packages/better-auth/src/plugins/organization/routes/crud-team.test.ts` (+255 -0) 📝 `packages/better-auth/src/plugins/organization/routes/crud-team.ts` (+37 -3) </details> ### 📄 Description This PR adds pagination support to the organization plugin's team and role listing endpoints. Organization members had a way of doing this already, so this is mostly an extension of that. Changes Made - Added `limit` and `offset` query parameters to `listTeams` endpoint - Added `limit` and `offset` query parameters to `listOrgRoles` endpoint - Added `limit` and `offset` query parameters to `listTeamMembers` endpoint - Added tests for `crud-team.ts - Added docs for new query params If I have missed anything just leave it in the comments and ill get on it :) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds pagination to organization team, role, and team member listing endpoints using limit and offset to reduce payload size and improve performance. Adapter and routes now pass pagination options; tests and docs included. - **New Features** - listTeams, listOrgRoles, and listTeamMembers accept optional limit and offset query params. - Adapter methods forward pagination to findMany with no change in behavior when omitted. - Added tests for pagination across roles, teams, and team members, and updated docs. <sup>Written for commit c2d3b301fe0634d3aed662cc62bd3f42e48ae320. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:53:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6279