Updates and Bugfixes

This commit is contained in:
Benjamin Toby 2024-11-06 12:23:58 +01:00
parent 54b7981be4
commit 82cacd6a15
3 changed files with 9 additions and 25 deletions

View File

@ -8,10 +8,10 @@ const runQuery = require("../../package-shared/functions/backend/db/runQuery");
* @async * @async
* *
* @param {Object} params - Single object passed * @param {Object} params - Single object passed
* @param {import("../../package-shared/types").LocalPostQueryObject} params.options - SQL Query * @param {import("../../package-shared/types").LocalPostQueryObject} params.options
* @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [params.dbSchema] - Name of the table to query * @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [params.dbSchema]
* *
* @returns { Promise<import("../../package-shared/types").LocalPostReturn> } - Return Object * @returns { Promise<import("../../package-shared/types").LocalPostReturn> }
*/ */
async function localPost({ options, dbSchema }) { async function localPost({ options, dbSchema }) {
try { try {
@ -62,28 +62,19 @@ async function localPost({ options, dbSchema }) {
payload: result, payload: result,
error: error, error: error,
}; };
////////////////////////////////////////
} catch (/** @type {*} */ error) { } catch (/** @type {*} */ error) {
////////////////////////////////////////
return { return {
success: false, success: false,
error: error.message, error: error.message,
}; };
} }
////////////////////////////////////////
} catch (/** @type {*} */ error) { } catch (/** @type {*} */ error) {
////////////////////////////////////////
console.log("Error in local post Request =>", error.message); console.log("Error in local post Request =>", error.message);
return { return {
success: false, success: false,
msg: "Something went wrong!", msg: "Something went wrong!",
}; };
////////////////////////////////////////
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "2.3.7", "version": "2.3.8",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@ -46,20 +46,13 @@ async function post({ key, query, queryValues, database, tableName }) {
* *
* @description Look for local db settings in `.env` file and by pass the http request if available * @description Look for local db settings in `.env` file and by pass the http request if available
*/ */
const { const { DSQL_DB_HOST, DSQL_DB_USERNAME, DSQL_DB_PASSWORD, DSQL_DB_NAME } =
DSQL_HOST, process.env;
DSQL_USER,
DSQL_PASS,
DSQL_DB_NAME,
DSQL_KEY,
DSQL_REF_DB_NAME,
DSQL_FULL_SYNC,
} = process.env;
if ( if (
DSQL_HOST?.match(/./) && DSQL_DB_HOST?.match(/./) &&
DSQL_USER?.match(/./) && DSQL_DB_USERNAME?.match(/./) &&
DSQL_PASS?.match(/./) && DSQL_DB_PASSWORD?.match(/./) &&
DSQL_DB_NAME?.match(/./) DSQL_DB_NAME?.match(/./)
) { ) {
/** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */ /** @type {import("../package-shared/types").DSQL_DatabaseSchemaType | undefined} */