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
@@ -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,