This commit is contained in:
2025-12-26 06:37:30 +01:00
parent 98aaa94b80
commit b02399c64d
50 changed files with 112 additions and 105 deletions
@@ -52,7 +52,7 @@ function checkDbRecordCreateDbSchema(_a) {
tableName: "user_databases",
forceLocal: true,
});
if ((_b = newDbEntry.payload) === null || _b === void 0 ? void 0 : _b.insertId) {
if ((_b = newDbEntry.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId) {
recordedDbEntryArray = (yield (0, dbHandler_1.default)({
query: `SELECT * FROM datasquirel.user_databases WHERE db_full_name = ?`,
values: [dbFullName || "NULL"],
@@ -74,7 +74,7 @@ function checkTableRecordCreateDbSchema(_a) {
dbContext: "Master",
forceLocal: true,
});
if ((_b = newTableRecordEntry.payload) === null || _b === void 0 ? void 0 : _b.insertId) {
if ((_b = newTableRecordEntry.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId) {
recordedTableEntryArray = (yield (0, dbHandler_1.default)({
query: (queryObj === null || queryObj === void 0 ? void 0 : queryObj.string) || "",
values: queryObj === null || queryObj === void 0 ? void 0 : queryObj.values,
@@ -78,7 +78,7 @@ function createUser() {
tableName: "users",
data: Object.assign(Object.assign({}, userObj), { password: hashedPassword }),
});
if (!((_a = newUser === null || newUser === void 0 ? void 0 : newUser.payload) === null || _a === void 0 ? void 0 : _a.insertId))
if (!((_a = newUser === null || newUser === void 0 ? void 0 : newUser.postInsertReturn) === null || _a === void 0 ? void 0 : _a.insertId))
return false;
const { STATIC_ROOT } = (0, grab_dir_names_1.default)();
if (!STATIC_ROOT) {
@@ -90,17 +90,17 @@ function createUser() {
*
* @description Create new user folder and file
*/
let newUserSchemaFolderPath = `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${newUser.payload.insertId}`;
let newUserMediaFolderPath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.payload.insertId}`);
let newUserSchemaFolderPath = `${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${newUser.postInsertReturn.insertId}`;
let newUserMediaFolderPath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.postInsertReturn.insertId}`);
fs_1.default.mkdirSync(newUserSchemaFolderPath, { recursive: true });
fs_1.default.mkdirSync(newUserMediaFolderPath, { recursive: true });
fs_1.default.writeFileSync(`${newUserSchemaFolderPath}/main.json`, JSON.stringify([]), "utf8");
const imageBasePath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.payload.insertId}`);
const imageBasePath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.postInsertReturn.insertId}`);
if (!fs_1.default.existsSync(imageBasePath)) {
fs_1.default.mkdirSync(imageBasePath, { recursive: true });
}
let imagePath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.payload.insertId}/user-${newUser.payload.insertId}-profile.jpg`);
let imageThumbnailPath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.payload.insertId}/user-${newUser.payload.insertId}-profile-thumbnail.jpg`);
let imagePath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.postInsertReturn.insertId}/user-${newUser.postInsertReturn.insertId}-profile.jpg`);
let imageThumbnailPath = path_1.default.join(STATIC_ROOT, `images/user-images/user-${newUser.postInsertReturn.insertId}/user-${newUser.postInsertReturn.insertId}-profile-thumbnail.jpg`);
let prodImageUrl = imagePath.replace(STATIC_ROOT, process.env.DSQL_STATIC_HOST || "");
let prodImageThumbnailUrl = imageThumbnailPath.replace(STATIC_ROOT, process.env.DSQL_STATIC_HOST || "");
fs_1.default.copyFileSync(path_1.default.join(ROOT_DIR, "/public/images/user-preset.png"), imagePath);
@@ -110,7 +110,7 @@ function createUser() {
dbFullName: "datasquirel",
tableName: "users",
identifierColumnName: "id",
identifierValue: newUser.payload.insertId,
identifierValue: newUser.postInsertReturn.insertId,
data: {
image: prodImageUrl,
image_thumbnail: prodImageThumbnailUrl,
@@ -85,8 +85,8 @@ function default_1(_a) {
tableName: targetTableName,
dbFullName: targetDatabase,
});
if ((_b = newTableEntryRes === null || newTableEntryRes === void 0 ? void 0 : newTableEntryRes.payload) === null || _b === void 0 ? void 0 : _b.insertId) {
tableId = newTableEntryRes.payload.insertId;
if ((_b = newTableEntryRes === null || newTableEntryRes === void 0 ? void 0 : newTableEntryRes.postInsertReturn) === null || _b === void 0 ? void 0 : _b.insertId) {
tableId = newTableEntryRes.postInsertReturn.insertId;
}
}
if (newTableSchema.tableNameOld) {