This commit is contained in:
Tben 2023-07-08 06:47:57 +01:00
parent 5215c06b18
commit 4452c04924
5 changed files with 29 additions and 15 deletions

View File

@ -133,9 +133,6 @@ async function addDb({ dbFullName, tableName, data, tableSchema, duplicateColumn
const query = `INSERT INTO \`${tableName}\` (${insertKeysArray.join(",")}) VALUES (${insertValuesArray.map(() => "?").join(",")})`; const query = `INSERT INTO \`${tableName}\` (${insertKeysArray.join(",")}) VALUES (${insertValuesArray.map(() => "?").join(",")})`;
const queryValuesArray = insertValuesArray; const queryValuesArray = insertValuesArray;
console.log("DSQL: Query =>", query);
console.log("DSQL: Query Values =>", queryValuesArray);
const newInsert = await handler({ const newInsert = await handler({
queryString: query, queryString: query,
database: dbFullName, database: dbFullName,

View File

@ -35,3 +35,8 @@ module.exports = dsqlEngine;
//////////////////////////////////////// ////////////////////////////////////////
//////////////////////////////////////// ////////////////////////////////////////
//////////////////////////////////////// ////////////////////////////////////////
exports.add = dsqlEngine.db.add;
exports.update = dsqlEngine.db.update;
exports.delete = dsqlEngine.db.delete;
exports.query = dsqlEngine.db.query;

View File

@ -18,7 +18,7 @@ const parseDbResults = require("./parseDbResults");
* *
* @returns {Promise<object[]|null>} * @returns {Promise<object[]|null>}
*/ */
module.exports = async function handler({ queryString, queryValuesArray, database, tableSchema, dbHost, dbUsername, dbPassword, encryptionKey, encryptionSalt }) { async function handler({ queryString, queryValuesArray, database, tableSchema, dbHost, dbUsername, dbPassword, encryptionKey, encryptionSalt }) {
const mysql = require("serverless-mysql")({ const mysql = require("serverless-mysql")({
config: { config: {
host: dbHost, host: dbHost,
@ -89,4 +89,6 @@ module.exports = async function handler({ queryString, queryValuesArray, databas
console.log("\x1b[31mDSQL Database Handler No results returned\x1b[0m =>", results); console.log("\x1b[31mDSQL Database Handler No results returned\x1b[0m =>", results);
return null; return null;
} }
}; }
module.exports = handler;

View File

@ -15,6 +15,7 @@ const reAuthUser = require("./users/reauth-user");
const getUser = require("./users/get-user"); const getUser = require("./users/get-user");
const loginWithGoogle = require("./users/social/google-auth"); const loginWithGoogle = require("./users/social/google-auth");
const sanitizeSql = require("./utils/functions/sanitizeSql"); const sanitizeSql = require("./utils/functions/sanitizeSql");
const engine = require("./engine/index");
/** ****************************************************************************** */ /** ****************************************************************************** */
/** ****************************************************************************** */ /** ****************************************************************************** */
@ -24,9 +25,8 @@ const sanitizeSql = require("./utils/functions/sanitizeSql");
/** ****************************************************************************** */ /** ****************************************************************************** */
/** /**
* ==============================================================================
* User Functions Object * User Functions Object
* ============================================================================== * ===================================
*/ */
const user = { const user = {
createUser: createUser, createUser: createUser,
@ -42,18 +42,16 @@ const user = {
}; };
/** /**
* ==============================================================================
* Media Functions Object * Media Functions Object
* ============================================================================== * ===================================
*/ */
const media = { const media = {
uploadImage: uploadImage, uploadImage: uploadImage,
}; };
/** /**
* ==============================================================================
* Main Export * Main Export
* ============================================================================== * ===================================
*/ */
const datasquirel = { const datasquirel = {
get: get, get: get,
@ -61,10 +59,22 @@ const datasquirel = {
media: media, media: media,
user: user, user: user,
sanitizeSql: sanitizeSql, sanitizeSql: sanitizeSql,
engine: engine,
}; };
module.exports = datasquirel; module.exports = datasquirel;
/** ********************************************** */ ////////////////////////////////////////
/** ********************************************** */ ////////////////////////////////////////
/** ********************************************** */ ////////////////////////////////////////
exports.get = datasquirel.get;
exports.post = datasquirel.post;
exports.media = datasquirel.media;
exports.user = datasquirel.user;
exports.sanitizeSql = datasquirel.sanitizeSql;
exports.engine = datasquirel.engine;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.1.73", "version": "1.1.74",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {