41 lines
2.3 KiB
JavaScript
41 lines
2.3 KiB
JavaScript
"use strict";
|
|
exports.id = 7638;
|
|
exports.ids = [7638];
|
|
exports.modules = {
|
|
|
|
/***/ 7638:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "default": () => (/* binding */ setUserSchemaData)
|
|
/* harmony export */ });
|
|
// @ts-check
|
|
const serverError = __webpack_require__(2163);
|
|
const fs = __webpack_require__(7147);
|
|
const path = __webpack_require__(1017);
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* @param {Object} params
|
|
* @param {string | number} params.userId
|
|
* @param {import("@/package-shared/types").DSQL_DatabaseSchemaType[]} params.schemaData
|
|
* @returns {boolean}
|
|
*/ function setUserSchemaData({ userId , schemaData }) {
|
|
try {
|
|
const userSchemaFilePath = path.resolve(process.cwd(), `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${userId}/main.json`);
|
|
fs.writeFileSync(userSchemaFilePath, JSON.stringify(schemaData), "utf8");
|
|
return true;
|
|
} catch (/** @type {any} */ error) {
|
|
serverError({
|
|
component: "/functions/backend/setUserSchemaData",
|
|
message: error.message
|
|
});
|
|
return false;
|
|
}
|
|
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
|
|
|
|
|
|
/***/ })
|
|
|
|
};
|
|
; |