updates
This commit is contained in:
parent
b43eb1f990
commit
cdcb3069c3
@ -30,7 +30,7 @@ const updateDb = require("./updateDb");
|
||||
*
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
module.exports = async function add({ dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
async function addDb({ dbFullName, tableName, data, tableSchema, duplicateColumnName, duplicateColumnValue, update, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
/**
|
||||
* Initialize variables
|
||||
*/
|
||||
@ -133,6 +133,9 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema,
|
||||
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,
|
||||
@ -153,4 +156,10 @@ module.exports = async function add({ dbFullName, tableName, data, tableSchema,
|
||||
* Return statement
|
||||
*/
|
||||
return newInsert;
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = addDb;
|
@ -24,7 +24,7 @@ const handler = require("../utils/handler");
|
||||
*
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
module.exports = async function deleteDb({ dbFullName, tableName, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
async function deleteDb({ dbFullName, tableName, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
try {
|
||||
/**
|
||||
* Check if data is valid
|
||||
@ -71,4 +71,10 @@ module.exports = async function deleteDb({ dbFullName, tableName, identifierColu
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = deleteDb;
|
||||
|
@ -19,7 +19,7 @@ const handler = require("../utils/handler");
|
||||
*
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
module.exports = async function query({ dbFullName, dbHost, dbPassword, dbUsername, query }) {
|
||||
async function query({ dbFullName, dbHost, dbPassword, dbUsername, query }) {
|
||||
/**
|
||||
* Initialize variables
|
||||
*/
|
||||
@ -74,4 +74,10 @@ module.exports = async function query({ dbFullName, dbHost, dbPassword, dbUserna
|
||||
console.log("\x1b[31mDSQL RAW Database Handler No results returned\x1b[0m =>", results);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = query;
|
||||
|
@ -25,7 +25,7 @@ const handler = require("../utils/handler");
|
||||
*
|
||||
* @returns {Promise<object|null>}
|
||||
*/
|
||||
module.exports = async function updateDb({ dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
async function updateDb({ dbFullName, tableName, data, tableSchema, identifierColumnName, identifierValue, dbHost, dbPassword, dbUsername, encryptionKey, encryptionSalt }) {
|
||||
/**
|
||||
* Check if data is valid
|
||||
*/
|
||||
@ -89,4 +89,10 @@ module.exports = async function updateDb({ dbFullName, tableName, data, tableSch
|
||||
* Return statement
|
||||
*/
|
||||
return updatedEntry;
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = updateDb;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Imports
|
||||
* ===================================
|
||||
*/
|
||||
const add = require("./db/add");
|
||||
const addDb = require("./db/addDb");
|
||||
const query = require("./db/query");
|
||||
const update = require("./db/updateDb");
|
||||
const deleteDb = require("./db/deleteDb");
|
||||
@ -16,7 +16,7 @@ const deleteDb = require("./db/deleteDb");
|
||||
* ===================================
|
||||
*/
|
||||
const db = {
|
||||
add: add,
|
||||
add: addDb,
|
||||
update: update,
|
||||
delete: deleteDb,
|
||||
query: query,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "datasquirel",
|
||||
"version": "1.1.70",
|
||||
"version": "1.1.71",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -38,7 +38,7 @@ const https = require("https");
|
||||
*
|
||||
* @returns { Promise<FunctionReturn> }
|
||||
*/
|
||||
module.exports = async function ({ key, payload, database }) {
|
||||
async function addUser({ key, payload, database }) {
|
||||
/**
|
||||
* Make https request
|
||||
*
|
||||
@ -93,8 +93,10 @@ module.exports = async function ({ key, payload, database }) {
|
||||
/** ********************************************** */
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = addUser;
|
||||
|
@ -4,7 +4,6 @@
|
||||
* ==============================================================================
|
||||
*/
|
||||
const https = require("https");
|
||||
const encrypt = require("../functions/encrypt");
|
||||
|
||||
/** ****************************************************************************** */
|
||||
/** ****************************************************************************** */
|
||||
@ -44,7 +43,7 @@ const encrypt = require("../functions/encrypt");
|
||||
*
|
||||
* @returns { Promise<FunctionReturn>}
|
||||
*/
|
||||
module.exports = async function ({ key, userId, database, fields }) {
|
||||
async function getUser({ key, userId, database, fields }) {
|
||||
/**
|
||||
* Make https request
|
||||
*
|
||||
@ -105,8 +104,10 @@ module.exports = async function ({ key, userId, database, fields }) {
|
||||
/** ********************************************** */
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = getUser;
|
||||
|
@ -55,7 +55,7 @@ const encrypt = require("../functions/encrypt");
|
||||
*
|
||||
* @returns { Promise<FunctionReturn>}
|
||||
*/
|
||||
module.exports = async function ({ key, payload, database, response, encryptionKey, encryptionSalt }) {
|
||||
async function loginUser({ key, payload, database, response, encryptionKey, encryptionSalt }) {
|
||||
/**
|
||||
* Check Encryption Keys
|
||||
*
|
||||
@ -170,8 +170,10 @@ module.exports = async function ({ key, payload, database, response, encryptionK
|
||||
/** ********************************************** */
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = loginUser;
|
||||
|
@ -12,7 +12,7 @@ const parseCookies = require("../utils/functions/parseCookies");
|
||||
*
|
||||
* @returns {{success: boolean, payload: string}}
|
||||
*/
|
||||
module.exports = function ({ request, response, database }) {
|
||||
function logoutUser({ request, response, database }) {
|
||||
/**
|
||||
* Check Encryption Keys
|
||||
*
|
||||
@ -62,8 +62,10 @@ module.exports = function ({ request, response, database }) {
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = logoutUser;
|
||||
|
@ -57,7 +57,7 @@ const userAuth = require("./user-auth");
|
||||
*
|
||||
* @returns { Promise<FunctionReturn> }
|
||||
*/
|
||||
module.exports = async function ({ key, database, response, request, level, encryptionKey, encryptionSalt }) {
|
||||
async function reauthUser({ key, database, response, request, level, encryptionKey, encryptionSalt }) {
|
||||
/**
|
||||
* Check Encryption Keys
|
||||
*
|
||||
@ -158,8 +158,10 @@ module.exports = async function ({ key, database, response, request, level, encr
|
||||
/** ********************************************** */
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = reauthUser;
|
||||
|
@ -37,7 +37,7 @@ const encrypt = require("../../functions/encrypt");
|
||||
*
|
||||
* @returns { Promise<FunctionReturn> }
|
||||
*/
|
||||
module.exports = async function ({ key, token, database, clientId, response, encryptionKey, encryptionSalt }) {
|
||||
async function googleAuth({ key, token, database, clientId, response, encryptionKey, encryptionSalt }) {
|
||||
/**
|
||||
* Check inputs
|
||||
*
|
||||
@ -183,8 +183,10 @@ module.exports = async function ({ key, token, database, clientId, response, enc
|
||||
////////////////////////////////////////
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
module.exports = googleAuth;
|
||||
|
@ -31,7 +31,7 @@ const https = require("https");
|
||||
*
|
||||
* @returns { Promise<FunctionReturn>}
|
||||
*/
|
||||
module.exports = async function ({ key, payload, database }) {
|
||||
async function updateUser({ key, payload, database }) {
|
||||
/**
|
||||
* Make https request
|
||||
*
|
||||
@ -86,8 +86,10 @@ module.exports = async function ({ key, payload, database }) {
|
||||
/** ********************************************** */
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = updateUser;
|
||||
|
@ -50,7 +50,7 @@ const parseCookies = require("../utils/functions/parseCookies");
|
||||
*
|
||||
* @returns { FunctionReturn }
|
||||
*/
|
||||
module.exports = function ({ request, encryptionKey, encryptionSalt, level, database }) {
|
||||
function userAuth({ request, encryptionKey, encryptionSalt, level, database }) {
|
||||
try {
|
||||
/**
|
||||
* Grab the payload
|
||||
@ -146,8 +146,10 @@ module.exports = function ({ request, encryptionKey, encryptionSalt, level, data
|
||||
msg: error.message,
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = userAuth;
|
||||
|
@ -31,7 +31,7 @@ const https = require("https");
|
||||
*
|
||||
* @returns { Promise<GetReturn> } - Return Object
|
||||
*/
|
||||
module.exports = async function ({ key, db, query }) {
|
||||
async function get({ key, db, query }) {
|
||||
/**
|
||||
* Make https request
|
||||
*
|
||||
@ -83,8 +83,10 @@ module.exports = async function ({ key, db, query }) {
|
||||
/** ********************************************** */
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = get;
|
||||
|
@ -42,7 +42,7 @@ const https = require("https");
|
||||
*
|
||||
* @returns { Promise<PostReturn> } - Return Object
|
||||
*/
|
||||
module.exports = async function ({ key, query, database }) {
|
||||
async function post({ key, query, database }) {
|
||||
/**
|
||||
* Make https request
|
||||
*
|
||||
@ -133,8 +133,10 @@ module.exports = async function ({ key, query, database }) {
|
||||
/** ********************************************** */
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = post;
|
||||
|
@ -39,7 +39,7 @@ const https = require("https");
|
||||
*
|
||||
* @returns { Promise<FunctionReturn> } - Return Object
|
||||
*/
|
||||
module.exports = async function ({ key, payload }) {
|
||||
async function uploadImage({ key, payload }) {
|
||||
/**
|
||||
* Make https request
|
||||
*
|
||||
@ -92,8 +92,10 @@ module.exports = async function ({ key, payload }) {
|
||||
/** ********************************************** */
|
||||
|
||||
return httpResponse;
|
||||
};
|
||||
}
|
||||
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
/** ********************************************** */
|
||||
|
||||
module.exports = uploadImage;
|
||||
|
Loading…
Reference in New Issue
Block a user