Correction du chemin de création du dossier de projet lors du téléchargement d'images de mesure

This commit is contained in:
2025-02-11 16:59:43 +01:00
parent f6bd365daf
commit 5119ee488a

View File

@@ -3,16 +3,9 @@ import path from 'path';
import storageManager from '../data/storageManager.js'; import storageManager from '../data/storageManager.js';
async function uploadMeasureImage(image, projectId, orderId) { async function uploadMeasureImage(image, projectId, orderId) {
// Create the project directory if it doesn't exist const projectDir = storageManager.createFolder('./storage/' + projectId.toString());
const projectDir = storageManager.createFolder(projectId.toString());
// Create the images directory within the project directory
const imagesDir = storageManager.createFolder(path.join(projectDir, 'images')); const imagesDir = storageManager.createFolder(path.join(projectDir, 'images'));
var imagePath = path.join(imagesDir, `${orderId}.jpg`);
// Define the path where the image will be saved
const imagePath = path.join(imagesDir, `${orderId}.jpg`);
// Save the uploaded image to the defined path
storageManager.saveFile(imagePath, image.buffer); storageManager.saveFile(imagePath, image.buffer);
return imagePath; return imagePath;