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
-1
View File
@@ -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");
+6 -2
View File
@@ -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,
-1
View File
@@ -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 {