57 lines
1.6 KiB
JavaScript
57 lines
1.6 KiB
JavaScript
|
"use strict";
|
||
|
exports.id = 9132;
|
||
|
exports.ids = [9132];
|
||
|
exports.modules = {
|
||
|
|
||
|
/***/ 9132:
|
||
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
|
||
|
// @ts-check
|
||
|
|
||
|
const fs = __webpack_require__(7147);
|
||
|
const serverError = __webpack_require__(3017);
|
||
|
const NO_DB_HANDLER = __webpack_require__(7487);
|
||
|
/**
|
||
|
* Create database from Schema Function
|
||
|
* ==============================================================================
|
||
|
* @param {string} queryString - Query String
|
||
|
* @returns {Promise<any>}
|
||
|
*/ module.exports = async function noDatabaseDbHandler(queryString) {
|
||
|
"production"?.match(/dev/) && fs.appendFileSync("./.tmp/sqlQuery.sql", queryString + "\n" + Date() + "\n\n\n", "utf8");
|
||
|
/**
|
||
|
* Declare variables
|
||
|
*
|
||
|
* @description Declare "results" variable
|
||
|
*/ let results;
|
||
|
/**
|
||
|
* Fetch from db
|
||
|
*
|
||
|
* @description Fetch data from db if no cache
|
||
|
*/ try {
|
||
|
/** ********************* Run Query */ results = await NO_DB_HANDLER(queryString);
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
} catch (/** @type {any} */ error) {
|
||
|
serverError({
|
||
|
component: "noDatabaseDbHandler",
|
||
|
message: error.message
|
||
|
});
|
||
|
console.log("ERROR in noDatabaseDbHandler =>", error.message);
|
||
|
}
|
||
|
/**
|
||
|
* Return results
|
||
|
*
|
||
|
* @description Return results add to cache if "req" param is passed
|
||
|
*/ if (results) {
|
||
|
return results;
|
||
|
} else {
|
||
|
return null;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ })
|
||
|
|
||
|
};
|
||
|
;
|