This commit is contained in:
Tben 2023-07-07 16:45:55 +01:00
parent d0a64858ec
commit 152fd56301
2 changed files with 24 additions and 21 deletions

View File

@ -95,6 +95,7 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema,
let insertValuesArray = []; let insertValuesArray = [];
for (let i = 0; i < dataKeys.length; i++) { for (let i = 0; i < dataKeys.length; i++) {
try {
const dataKey = dataKeys[i]; const dataKey = dataKeys[i];
let value = data[dataKey]; let value = data[dataKey];
@ -108,7 +109,7 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema,
} }
if (targetFieldSchema?.richText) { if (targetFieldSchema?.richText) {
value = sanitizeHtml(value, sanitizeHtmlOptions).replace(/\n|\r|\n\r/gm, ""); value = sanitizeHtml(value, sanitizeHtmlOptions);
} }
insertKeysArray.push("`" + dataKey + "`"); insertKeysArray.push("`" + dataKey + "`");
@ -118,6 +119,9 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema,
} }
insertValuesArray.push(value); insertValuesArray.push(value);
} catch (error) {
console.log("Error in add DB try catch block =>", error.message);
}
} }
/** ********************************************** */ /** ********************************************** */

View File

@ -24,7 +24,7 @@ const handler = require("../utils/handler");
* *
* @returns {Promise<object|null>} * @returns {Promise<object|null>}
*/ */
module.exports = async function deleteDb({ dbFullName, tableName, tableSchema, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) { module.exports = async function deleteDb({ dbFullName, tableName, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
try { try {
/** /**
* Check if data is valid * Check if data is valid
@ -50,7 +50,6 @@ module.exports = async function deleteDb({ dbFullName, tableName, tableSchema, i
dbUsername, dbUsername,
encryptionKey, encryptionKey,
encryptionSalt, encryptionSalt,
tableSchema,
}); });
//////////////////////////////////////// ////////////////////////////////////////