[PR #1425] [MERGED] feat: team support for organization #20703

Closed
opened 2026-04-15 19:52:38 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1425
Author: @Bekacru
Created: 2/12/2025
Status: Merged
Merged: 2/28/2025
Merged by: @Bekacru

Base: mainHead: feat/team-org


📝 Commits (10+)

  • 1197b17 feat: teams in org
  • a817432 conditional based expose team endpoint
  • 16c1b00 mod on adapter
  • 0b8c844 team org wip
  • bf42397 wip
  • b852dcd dynamic type inference
  • 5f78173 add test
  • b7c5a3e feat: enhance organization adapter with default team creation and member timestamps
  • ea4eb0e feat: add maximum teams limit and prevent removal of last team
  • 553e65d refactor: remove outdated description from plugins documentation

📊 Changes

14 files changed (+1148 additions, -146 deletions)

View changed files

📝 docs/content/docs/concepts/plugins.mdx (+1 -1)
📝 docs/content/docs/plugins/organization.mdx (+129 -0)
📝 packages/better-auth/src/db/internal-adapter.ts (+1 -1)
📝 packages/better-auth/src/plugins/organization/adapter.ts (+142 -5)
📝 packages/better-auth/src/plugins/organization/client.ts (+27 -20)
📝 packages/better-auth/src/plugins/organization/error-codes.ts (+8 -0)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+30 -17)
📝 packages/better-auth/src/plugins/organization/organization.ts (+152 -8)
📝 packages/better-auth/src/plugins/organization/routes/crud-invites.ts (+55 -6)
📝 packages/better-auth/src/plugins/organization/routes/crud-members.ts (+19 -15)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.ts (+117 -65)
packages/better-auth/src/plugins/organization/routes/crud-team.ts (+190 -0)
📝 packages/better-auth/src/plugins/organization/schema.ts (+61 -8)
packages/better-auth/src/plugins/organization/team.test.ts (+216 -0)

📄 Description

This PR brings teams for organizations. It's an optional feature that you can turn on by setting teams.enabled to true. Once it's activated, it sets up a schema for teams and adds a teamId to the member and invitation tables. Plus, it opens up endpoints for managing everything related to teams.

closes #496

  • Implementation
  • Test
  • Documentation

🔄 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/1425 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 2/12/2025 **Status:** ✅ Merged **Merged:** 2/28/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `feat/team-org` --- ### 📝 Commits (10+) - [`1197b17`](https://github.com/better-auth/better-auth/commit/1197b17700119bca5bb1fb14508c7dc3e13bc9ca) feat: teams in org - [`a817432`](https://github.com/better-auth/better-auth/commit/a817432b19f4dd47a56f53787566b9d83a6b72cf) conditional based expose team endpoint - [`16c1b00`](https://github.com/better-auth/better-auth/commit/16c1b003f96914ca2f57ec7076d9f5d7f8fe29ae) mod on adapter - [`0b8c844`](https://github.com/better-auth/better-auth/commit/0b8c84418c63faef2c1ab96a009d535101c676c1) team org wip - [`bf42397`](https://github.com/better-auth/better-auth/commit/bf42397f3e0a7945a708604a09930a92019eccf5) wip - [`b852dcd`](https://github.com/better-auth/better-auth/commit/b852dcdd4e89798428d0f697f57a7f8542a473b6) dynamic type inference - [`5f78173`](https://github.com/better-auth/better-auth/commit/5f78173ce621b9aa36110cf5af976a0de8c81ce5) add test - [`b7c5a3e`](https://github.com/better-auth/better-auth/commit/b7c5a3e957fc25bdde79dfd5db7b75f58190151b) feat: enhance organization adapter with default team creation and member timestamps - [`ea4eb0e`](https://github.com/better-auth/better-auth/commit/ea4eb0e4e91b99d8c355c7b3e4dd2970e5f097cc) feat: add maximum teams limit and prevent removal of last team - [`553e65d`](https://github.com/better-auth/better-auth/commit/553e65d04b4fbf7928985cfbd60a077f59795f75) refactor: remove outdated description from plugins documentation ### 📊 Changes **14 files changed** (+1148 additions, -146 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/concepts/plugins.mdx` (+1 -1) 📝 `docs/content/docs/plugins/organization.mdx` (+129 -0) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/organization/adapter.ts` (+142 -5) 📝 `packages/better-auth/src/plugins/organization/client.ts` (+27 -20) 📝 `packages/better-auth/src/plugins/organization/error-codes.ts` (+8 -0) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+30 -17) 📝 `packages/better-auth/src/plugins/organization/organization.ts` (+152 -8) 📝 `packages/better-auth/src/plugins/organization/routes/crud-invites.ts` (+55 -6) 📝 `packages/better-auth/src/plugins/organization/routes/crud-members.ts` (+19 -15) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.ts` (+117 -65) ➕ `packages/better-auth/src/plugins/organization/routes/crud-team.ts` (+190 -0) 📝 `packages/better-auth/src/plugins/organization/schema.ts` (+61 -8) ➕ `packages/better-auth/src/plugins/organization/team.test.ts` (+216 -0) </details> ### 📄 Description This PR brings teams for organizations. It's an optional feature that you can turn on by setting `teams.enabled` to true. Once it's activated, it sets up a schema for teams and adds a `teamId` to the member and invitation tables. Plus, it opens up endpoints for managing everything related to teams. closes #496 - [x] Implementation - [x] Test - [x] Documentation --- <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-04-15 19:52:38 -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#20703