Bugfix
This commit is contained in:
parent
e41224bab7
commit
1acdad97a2
@ -66,7 +66,6 @@ function reauthUser(_a) {
|
||||
(DSQL_DB_PASSWORD === null || DSQL_DB_PASSWORD === void 0 ? void 0 : DSQL_DB_PASSWORD.match(/./)) &&
|
||||
(DSQL_DB_NAME === null || DSQL_DB_NAME === void 0 ? void 0 : DSQL_DB_NAME.match(/./)) &&
|
||||
global.DSQL_USE_LOCAL) {
|
||||
/** @type {import("../../types").DSQL_DatabaseSchemaType | undefined} */
|
||||
let dbSchema;
|
||||
try {
|
||||
const localDbSchemaPath = path_1.default.resolve(process.cwd(), "dsql.schema.json");
|
||||
|
@ -19,9 +19,14 @@ const varDatabaseDbHandler_1 = __importDefault(require("../../backend/varDatabas
|
||||
*/
|
||||
function apiReauthUser(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ existingUser, database, additionalFields, }) {
|
||||
const dbAppend = global.DSQL_USE_LOCAL
|
||||
? ""
|
||||
: database
|
||||
? `${database}.`
|
||||
: "";
|
||||
let foundUser = (existingUser === null || existingUser === void 0 ? void 0 : existingUser.id) && existingUser.id.toString().match(/./)
|
||||
? yield (0, varDatabaseDbHandler_1.default)({
|
||||
queryString: `SELECT * FROM ${database}.users WHERE id=?`,
|
||||
queryString: `SELECT * FROM ${dbAppend}users WHERE id=?`,
|
||||
queryValuesArray: [existingUser.id.toString()],
|
||||
database,
|
||||
})
|
||||
@ -35,7 +40,6 @@ function apiReauthUser(_a) {
|
||||
let csrfKey = Math.random().toString(36).substring(2) +
|
||||
"-" +
|
||||
Math.random().toString(36).substring(2);
|
||||
/** @type {import("../../../types").DATASQUIREL_LoggedInUser} */
|
||||
let userPayload = {
|
||||
id: foundUser[0].id,
|
||||
first_name: foundUser[0].first_name,
|
||||
|
@ -59,7 +59,6 @@ values) {
|
||||
}
|
||||
catch (error) {
|
||||
console.log(`connDbHandler Error: ${error.message}`);
|
||||
console.log(conn === null || conn === void 0 ? void 0 : conn.getConfig());
|
||||
return null;
|
||||
}
|
||||
finally {
|
||||
|
@ -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();
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/datasquirel",
|
||||
"version": "3.9.6",
|
||||
"version": "3.9.7",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
Loading…
Reference in New Issue
Block a user