Bugfixes
This commit is contained in:
parent
0a29973cc7
commit
d279d76246
@ -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);
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,6 @@ async function localAddUser({ payload, dbSchema }) {
|
||||
}
|
||||
|
||||
const addUser = await addDbEntry({
|
||||
dbContext: "Dsql User",
|
||||
paradigm: "Full Access",
|
||||
dbFullName: dbFullName,
|
||||
tableName: "users",
|
||||
data: {
|
||||
|
@ -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<FunctionReturn>} - 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,
|
||||
|
@ -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": {
|
||||
|
Loading…
Reference in New Issue
Block a user