Staff
Alias: Team Member
Represent a person who work in an healthcare facility as medical or non-medical staff.
Schema
| Property Name | Type | Required |
|---|---|---|
| team_id | string | YES |
| user_id | string | YES |
| type | CodedConcept | YES |
| status | CodedConcept | YES |
| membership_key | string | NO |
Auto-generated by better-auth
| Property Name | Type | Native Type (PostgreSQL) |
|---|---|---|
| id | string | text |
| created_at | string | timestampz |
Example
{
"id": "123",
"team_id": "123",
"user_id": "123",
"type": {
"system": "crn:staff",
"value": "medical",
"display": "Medical"
},
"status": {
"system": "crn:status:system",
"value": "active",
"display": "Active"
},
"membership_key": null,
"created_at": "2026-10-02 21:27:00+07"
}
Important Notes
Additional Field
Better Auth Organization plugin team member schema only consist of id, teamId, userId, membershipKey, createdAt. The other property defined above are additional field you must add in your better auth configuration like below
const auth = betterAuth({
plugins: [
organization({
schema: {
teamMember: {
additionalFields: {
type: {
type: "string",
required: true,
input: true,
},
status: {
type: "string",
required: true,
defaultValue: JSON.stringify({
system: "crn:status:system",
value: "active",
display: "Active",
}),
input: true,
},
},
},
},
}),
],
});
Read here to learn more on how to extend better auth core schema.
Case Style
Better Auth uses camelCase by default. To keep your database schema consistent in snake_case, add the following configuration:
const auth = betterAuth({
plugins: [
organization({
schema: {
teamMember: {
fields: {
teamId: "team_id",
userId: "user_id",
membershipKey: "membership_key",
createdAt: "created_at",
},
},
},
}),
],
});
Info
Type inference in your code will still use the original field names (e.g., teamMember.createdAt, not teamMember.created_at).