diff --git a/engine/query/utils/addDbEntry.js b/engine/query/utils/addDbEntry.js index e1034c1..6feefc3 100644 --- a/engine/query/utils/addDbEntry.js +++ b/engine/query/utils/addDbEntry.js @@ -15,9 +15,6 @@ const updateDbEntry = require("./updateDbEntry"); * @async * * @param {object} params - An object containing the function parameters. - * @param {("Master" | "Dsql User")} [params.dbContext] - What is the database context? "Master" - * or "Dsql User". Defaults to "Master" - * @param {("Read Only" | "Full Access")} [params.paradigm] - What is the paradigm for "Dsql User"? * "Read only" or "Full Access"? Defaults to "Read Only" * @param {string} params.dbFullName - Database full name * @param {string} params.tableName - Table name @@ -31,7 +28,7 @@ const updateDbEntry = require("./updateDbEntry"); * * @returns {Promise<*>} */ -async function addDbEntry({ dbContext, paradigm, dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, encryptionKey, encryptionSalt }) { +async function addDbEntry({ dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, encryptionKey, encryptionSalt }) { /** * Initialize variables */ @@ -55,8 +52,6 @@ async function addDbEntry({ dbContext, paradigm, dbFullName, tableName, data, ta return null; } else if (duplicateValue && duplicateValue[0] && update) { return await updateDbEntry({ - dbContext, - paradigm, dbFullName, tableName, data, @@ -90,7 +85,7 @@ async function addDbEntry({ dbContext, paradigm, dbFullName, tableName, data, ta if (!value) continue; if (targetFieldSchema?.encrypted) { - value = await encrypt({ data: value, encryptionKey, encryptionSalt }); + value = encrypt({ data: value, encryptionKey, encryptionSalt }); console.log("DSQL: Encrypted value =>", value); } diff --git a/engine/user/add-user.js b/engine/user/add-user.js index 2162bf7..a490101 100644 --- a/engine/user/add-user.js +++ b/engine/user/add-user.js @@ -103,8 +103,6 @@ async function localAddUser({ payload, dbSchema }) { } const addUser = await addDbEntry({ - dbContext: "Dsql User", - paradigm: "Full Access", dbFullName: dbFullName, tableName: "users", data: { diff --git a/engine/user/social/utils/handleSocialDb.js b/engine/user/social/utils/handleSocialDb.js index 1142ee9..1d1b3b6 100644 --- a/engine/user/social/utils/handleSocialDb.js +++ b/engine/user/social/utils/handleSocialDb.js @@ -72,7 +72,6 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || ""; * username: string, * }, * res: http.ServerResponse, - * invitation?: object|null, * supEmail?: string | null, * additionalFields?: object, * dbSchema: import("../../../../types/database-schema.td").DSQL_DatabaseSchemaType | undefined @@ -80,7 +79,7 @@ const encryptionSalt = process.env.DSQL_ENCRYPTION_SALT || ""; * * @returns {Promise} - Response object */ -async function handleSocialDb({ social_id, email, social_platform, payload, res, invitation, supEmail, additionalFields, dbSchema }) { +async function handleSocialDb({ social_id, email, social_platform, payload, res, supEmail, additionalFields, dbSchema }) { const tableSchema = dbSchema?.tables.find((tb) => tb?.tableName === "users"); try { @@ -127,7 +126,9 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res, let existingEmailOnly = await varDatabaseDbHandler({ database: database ? database : "datasquirel", - queryString: `SELECT * FROM users WHERE email='${finalEmail}'`, + queryString: `SELECT * FROM users WHERE email = ?`, + queryValuesArray: [finalEmail], + tableSchema, }); if (existingEmailOnly && existingEmailOnly[0]) { @@ -162,7 +163,7 @@ async function handleSocialDb({ social_id, email, social_platform, payload, res, //////////////////////////////////////////////// //////////////////////////////////////////////// - const socialHashedPassword = await encrypt({ + const socialHashedPassword = encrypt({ data: social_id.toString(), encryptionKey, encryptionSalt, diff --git a/package.json b/package.json index 39b2a10..0b6c26c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.7.4", + "version": "1.7.5", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": {