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 queryValuesArray = insertValuesArray;
console.log("DSQL: Query =>", query);
console.log("DSQL: Query Values =>", queryValuesArray);
const newInsert = await handler({
queryString: query,
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>}
*/
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")({
config: {
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);
return null;
}
};
}
module.exports = handler;

View File

@ -15,6 +15,7 @@ const reAuthUser = require("./users/reauth-user");
const getUser = require("./users/get-user");
const loginWithGoogle = require("./users/social/google-auth");
const sanitizeSql = require("./utils/functions/sanitizeSql");
const engine = require("./engine/index");
/** ****************************************************************************** */
/** ****************************************************************************** */
@ -24,9 +25,8 @@ const sanitizeSql = require("./utils/functions/sanitizeSql");
/** ****************************************************************************** */
/**
* ==============================================================================
* User Functions Object
* ==============================================================================
* ===================================
*/
const user = {
createUser: createUser,
@ -42,18 +42,16 @@ const user = {
};
/**
* ==============================================================================
* Media Functions Object
* ==============================================================================
* ===================================
*/
const media = {
uploadImage: uploadImage,
};
/**
* ==============================================================================
* Main Export
* ==============================================================================
* ===================================
*/
const datasquirel = {
get: get,
@ -61,10 +59,22 @@ const datasquirel = {
media: media,
user: user,
sanitizeSql: sanitizeSql,
engine: engine,
};
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",
"version": "1.1.73",
"version": "1.1.74",
"description": "Cloud-based SQL data management tool",
"main": "index.js",
"scripts": {