fix: use the default table names on username and phone auth

This commit is contained in:
Bereket Engida
2024-11-21 22:05:03 +03:00
parent f9c1e02c86
commit d4d38260f1
3 changed files with 5 additions and 9 deletions

View File

@@ -34,7 +34,7 @@ const createTransform = (
const schemaModel = schema[model];
if (!schemaModel) {
throw new BetterAuthError(
`[# Drizzle Adapter]: The model "${modelName}" was not found in the schema object. Please pass the schema directly to the adapter options.`,
`[# Drizzle Adapter]: The model "${model}" was not found in the schema object. Please pass the schema directly to the adapter options.`,
);
}
return schemaModel;

View File

@@ -319,7 +319,7 @@ export const phoneNumber = (options?: {
}
let user = await ctx.context.adapter.findOne<UserWithPhoneNumber>({
model: ctx.context.tables.user.modelName,
model: "user",
where: [
{
value: ctx.body.phoneNumber,

View File

@@ -21,7 +21,7 @@ export const username = () => {
},
async (ctx) => {
const user = await ctx.context.adapter.findOne<User>({
model: ctx.context.tables.user.modelName,
model: "user",
where: [
{
field: "username",
@@ -40,15 +40,11 @@ export const username = () => {
model: "account",
where: [
{
field:
ctx.context.tables.account.fields.userId.fieldName ||
"userId",
field: "userId",
value: user.id,
},
{
field:
ctx.context.tables.account.fields.providerId.fieldName ||
"providerId",
field: "providerId",
value: "credential",
},
],