Megamind
Megamind
BABetter Auth
Created by Kasszz on 4/13/2025 in #help
Adding custom properties to Organization members
So i modified the schema in Prisma directly
model Member {
id String @id @map("_id")
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
role String
customFields Json? // Stores the custom field values as JSON
// customFields [
// {
// "address": "123 Main St",
// "zipCode": "12345"
// }
// ]
createdAt DateTime

@@map("member")
}
model Member {
id String @id @map("_id")
organizationId String
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
role String
customFields Json? // Stores the custom field values as JSON
// customFields [
// {
// "address": "123 Main St",
// "zipCode": "12345"
// }
// ]
createdAt DateTime

@@map("member")
}
10 replies
BABetter Auth
Created by Kasszz on 4/13/2025 in #help
Adding custom properties to Organization members
The docs has examples of adding new fields to the user schema. But it doesn't give suggestions for adding new fields to organization members schema
10 replies
BABetter Auth
Created by nktnet on 1/1/2025 in #help
Typescript - database hook type inference for additional fields
I am using the organizations plugin. And trying to add addition fields to the members. I have updated the tables manually with prisma schema. The additional fields are not being added to the db.
9 replies
BABetter Auth
Created by Kasszz on 4/13/2025 in #help
Adding custom properties to Organization members
i am also trying to add custom/additional fields to members. i am using organizations plugin. could someone please guide me on this? i have defined the schema in Prisma manually, but the values are not being added here is my code.
await auth.api.addMember({
body: { organizationId,
userId: user.id, role:faker.helpers.arrayElement(["admin", "member"] as const),
customFields: {
address: faker.location.streetAddress(),
zipCode: faker.location.zipCode(),
},
},
});

await auth.api.addMember({
body: { organizationId,
userId: user.id, role:faker.helpers.arrayElement(["admin", "member"] as const),
customFields: {
address: faker.location.streetAddress(),
zipCode: faker.location.zipCode(),
},
},
});

10 replies
BABetter Auth
Created by Kasszz on 4/13/2025 in #help
Adding custom properties to Organization members
Hi @Kasszz any update on this?
10 replies
BABetter Auth
Created by Benfa on 4/15/2025 in #help
Additional fields missing from User type
how can i add additional feilds to the members schema? i am using organizations plugin. could you please guide me on this? i have defined the schema in Prisma manually, but the values are not being added here is my code.
await auth.api.addMember({
body: { organizationId,
userId: user.id, role:faker.helpers.arrayElement(["admin", "member"] as const),
customFields: {
address: faker.location.streetAddress(),
zipCode: faker.location.zipCode(),
},
},
});
await auth.api.addMember({
body: { organizationId,
userId: user.id, role:faker.helpers.arrayElement(["admin", "member"] as const),
customFields: {
address: faker.location.streetAddress(),
zipCode: faker.location.zipCode(),
},
},
});
7 replies
BABetter Auth
Created by nktnet on 1/1/2025 in #help
Typescript - database hook type inference for additional fields
i am doing similiar. the feilds are not added
9 replies