This commit is contained in:
Benjamin Toby
2025-01-27 16:21:55 +01:00
parent e41224bab7
commit 1acdad97a2
7 changed files with 14 additions and 9 deletions
@@ -92,7 +92,6 @@ export default async function reauthUser({
DSQL_DB_NAME?.match(/./) &&
global.DSQL_USE_LOCAL
) {
/** @type {import("../../types").DSQL_DatabaseSchemaType | undefined} */
let dbSchema: import("../../types").DSQL_DatabaseSchemaType | undefined;
try {
@@ -15,10 +15,16 @@ export default async function apiReauthUser({
database,
additionalFields,
}: Param): Promise<APILoginFunctionReturn> {
const dbAppend = global.DSQL_USE_LOCAL
? ""
: database
? `${database}.`
: "";
let foundUser =
existingUser?.id && existingUser.id.toString().match(/./)
? await varDatabaseDbHandler({
queryString: `SELECT * FROM ${database}.users WHERE id=?`,
queryString: `SELECT * FROM ${dbAppend}users WHERE id=?`,
queryValuesArray: [existingUser.id.toString()],
database,
})
@@ -36,7 +42,6 @@ export default async function apiReauthUser({
"-" +
Math.random().toString(36).substring(2);
/** @type {import("../../../types").DATASQUIREL_LoggedInUser} */
let userPayload: import("../../../types").DATASQUIREL_LoggedInUser = {
id: foundUser[0].id,
first_name: foundUser[0].first_name,
@@ -56,7 +56,6 @@ export default async function connDbHandler<ReturnType = any>(
}
} catch (error: any) {
console.log(`connDbHandler Error: ${error.message}`);
console.log(conn?.getConfig());
return null;
} finally {
conn?.end();