This commit is contained in:
Benjamin Toby
2024-11-05 15:47:45 +01:00
parent 748ff55092
commit f2a402d718
230 changed files with 351 additions and 307 deletions
@@ -33,8 +33,6 @@ async function createUser() {
if (typeof userObj !== "object" || Array.isArray(userObj))
throw new Error("User Object Invalid!");
console.log("userObj", userObj);
const ROOT_DIR = path.resolve(__dirname, "../../../");
/**
@@ -114,6 +112,15 @@ async function createUser() {
"utf8"
);
const imageBasePath = path.join(
STATIC_ROOT,
`images/user-images/user-${newUser.insertId}`
);
if (!fs.existsSync(imageBasePath)) {
fs.mkdirSync(imageBasePath, { recursive: true });
}
let imagePath = path.join(
STATIC_ROOT,
`images/user-images/user-${newUser.insertId}/user-${newUser.insertId}-profile.jpg`