mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-11 04:19:31 +00:00
fix: org adapter shouldn't use dynamic table names
This commit is contained in:
@@ -70,7 +70,7 @@ export const getOrgAdapter = (
|
|||||||
organizationId: string;
|
organizationId: string;
|
||||||
}) => {
|
}) => {
|
||||||
const user = await adapter.findOne<User>({
|
const user = await adapter.findOne<User>({
|
||||||
model: context.tables.user.modelName,
|
model: "user",
|
||||||
where: [
|
where: [
|
||||||
{
|
{
|
||||||
field: "email",
|
field: "email",
|
||||||
@@ -126,7 +126,7 @@ export const getOrgAdapter = (
|
|||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
await adapter.findOne<User>({
|
await adapter.findOne<User>({
|
||||||
model: context.tables.user.modelName,
|
model: "user",
|
||||||
where: [
|
where: [
|
||||||
{
|
{
|
||||||
field: "id",
|
field: "id",
|
||||||
@@ -162,7 +162,7 @@ export const getOrgAdapter = (
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const user = await adapter.findOne<User>({
|
const user = await adapter.findOne<User>({
|
||||||
model: context.tables.user.modelName,
|
model: "user",
|
||||||
where: [
|
where: [
|
||||||
{
|
{
|
||||||
field: "id",
|
field: "id",
|
||||||
@@ -268,7 +268,7 @@ export const getOrgAdapter = (
|
|||||||
organizationId: string | null,
|
organizationId: string | null,
|
||||||
) => {
|
) => {
|
||||||
const session = await adapter.update<Session>({
|
const session = await adapter.update<Session>({
|
||||||
model: context.tables.session.modelName,
|
model: "session",
|
||||||
where: [
|
where: [
|
||||||
{
|
{
|
||||||
field: "id",
|
field: "id",
|
||||||
@@ -316,7 +316,7 @@ export const getOrgAdapter = (
|
|||||||
|
|
||||||
const userIds = members.map((member) => member.userId);
|
const userIds = members.map((member) => member.userId);
|
||||||
const users = await adapter.findMany<User>({
|
const users = await adapter.findMany<User>({
|
||||||
model: context.tables.user.modelName,
|
model: "user",
|
||||||
where: [{ field: "id", value: userIds, operator: "in" }],
|
where: [{ field: "id", value: userIds, operator: "in" }],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user