[PR #6684] feat(organization): additional fields support for team members table #32424

Open
opened 2026-04-17 23:14:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6684
Author: @benlavalley
Created: 12/11/2025
Status: 🔄 Open

Base: nextHead: feat/team-member-additional-fields


📝 Commits (5)

  • 0133b32 feat(organization): add support for additional fields to team members
  • 4fff4d5 chore(organization): fix typo in test
  • c686e96 docs: update documentation to reflect custom field support for teamMember tables
  • a7d4f46 Merge branch 'canary' into feat/team-member-additional-fields
  • b6781d6 Merge remote-tracking branch 'upstream/canary' into feat/team-member-additional-fields

📊 Changes

9 files changed (+196 additions, -82 deletions)

View changed files

📝 docs/content/docs/plugins/organization.mdx (+1 -1)
📝 packages/better-auth/src/plugins/organization/adapter.ts (+23 -14)
📝 packages/better-auth/src/plugins/organization/client.test.ts (+1 -1)
📝 packages/better-auth/src/plugins/organization/organization.test.ts (+110 -37)
📝 packages/better-auth/src/plugins/organization/organization.ts (+16 -14)
📝 packages/better-auth/src/plugins/organization/routes/crud-org.ts (+2 -2)
📝 packages/better-auth/src/plugins/organization/routes/crud-team.ts (+32 -13)
📝 packages/better-auth/src/plugins/organization/schema.ts (+8 -0)
📝 packages/better-auth/src/plugins/organization/types.ts (+3 -0)

📄 Description

This PR updates the teamMember table with support for additionalFields.

Nearly all other aspects of organizations support additional fields and this brings teamMember up to parity with them.

An issue was opened for this at one point and closed shortly afterwards by it's creator, #4786.

There is some overlap in the tests between organization and team-specific tests but I felt it best to continue with the theme of keeping the tests for all additionalFields centralized to the organization tests.


Summary by cubic

Adds support for additionalFields on the teamMember table so teams match the rest of the organization models. Endpoints, types, and hooks now accept, infer, and persist custom team member fields.

  • New Features

    • TeamMember supports custom fields with full type inference via InferTeamMember.
    • addTeamMember accepts and validates additional fields; responses include them.
    • beforeAddTeamMember hook can modify the payload to set/update custom fields.
  • Refactors

    • Adapter and routes use InferTeamMember; list/find/create return inferred shapes.
    • Docs updated to include teamMember in Additional Fields; tests cover team member custom fields.

Written for commit b6781d6809. Summary will update 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/6684 **Author:** [@benlavalley](https://github.com/benlavalley) **Created:** 12/11/2025 **Status:** 🔄 Open **Base:** `next` ← **Head:** `feat/team-member-additional-fields` --- ### 📝 Commits (5) - [`0133b32`](https://github.com/better-auth/better-auth/commit/0133b32422bd5c2cefd51a9c0948098acc678fba) feat(organization): add support for additional fields to team members - [`4fff4d5`](https://github.com/better-auth/better-auth/commit/4fff4d57b68c37fbca3d093c2aae81f045102e78) chore(organization): fix typo in test - [`c686e96`](https://github.com/better-auth/better-auth/commit/c686e96b30f386cd03542b175ffffe376b454908) docs: update documentation to reflect custom field support for teamMember tables - [`a7d4f46`](https://github.com/better-auth/better-auth/commit/a7d4f4675f8cc3f588687504016580fc8c73f6c6) Merge branch 'canary' into feat/team-member-additional-fields - [`b6781d6`](https://github.com/better-auth/better-auth/commit/b6781d68098673c3ae8ee0750066382d69bed533) Merge remote-tracking branch 'upstream/canary' into feat/team-member-additional-fields ### 📊 Changes **9 files changed** (+196 additions, -82 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/organization.mdx` (+1 -1) 📝 `packages/better-auth/src/plugins/organization/adapter.ts` (+23 -14) 📝 `packages/better-auth/src/plugins/organization/client.test.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/organization/organization.test.ts` (+110 -37) 📝 `packages/better-auth/src/plugins/organization/organization.ts` (+16 -14) 📝 `packages/better-auth/src/plugins/organization/routes/crud-org.ts` (+2 -2) 📝 `packages/better-auth/src/plugins/organization/routes/crud-team.ts` (+32 -13) 📝 `packages/better-auth/src/plugins/organization/schema.ts` (+8 -0) 📝 `packages/better-auth/src/plugins/organization/types.ts` (+3 -0) </details> ### 📄 Description This PR updates the teamMember table with support for additionalFields. Nearly all other aspects of organizations support additional fields and this brings teamMember up to parity with them. An issue was opened for this at one point and closed shortly afterwards by it's creator, [#4786](https://github.com/better-auth/better-auth/issues/4786). There is some overlap in the tests between organization and team-specific tests but I felt it best to continue with the theme of keeping the tests for all additionalFields centralized to the organization tests. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds support for additionalFields on the teamMember table so teams match the rest of the organization models. Endpoints, types, and hooks now accept, infer, and persist custom team member fields. - **New Features** - TeamMember supports custom fields with full type inference via InferTeamMember. - addTeamMember accepts and validates additional fields; responses include them. - beforeAddTeamMember hook can modify the payload to set/update custom fields. - **Refactors** - Adapter and routes use InferTeamMember; list/find/create return inferred shapes. - Docs updated to include teamMember in Additional Fields; tests cover team member custom fields. <sup>Written for commit b6781d68098673c3ae8ee0750066382d69bed533. Summary will update 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-04-17 23:14:23 -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#32424