Skip to content

Commit

Permalink
Edit Product Models: change structure gcs
Browse files Browse the repository at this point in the history
  • Loading branch information
RobyYasirAmri committed Jun 11, 2024
1 parent 2b1c28e commit ba8c7ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/productController.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const createProduct = async (req, res) => {
// pictureUrl = await uploadImageToGCS(req.file, tenant.name_tenants);
// }
if (req.files && req.files.length > 0) {
const folderName = `tenants/${tenant.name_tenants};`
const folderName = `tenants/${tenant.name_tenants}/products_images;`
const uploadPromises = req.files.map((file) => uploadImageToGCS(file, folderName));
pictureUrls = await Promise.all(uploadPromises);
}
Expand Down Expand Up @@ -137,7 +137,7 @@ export const updateProduct = async (req, res) => {

let pictureUrls = [];
if (req.files && req.files.length > 0) {
const folderName = `tenants/${tenant.name_tenants};`
const folderName = `tenants/${tenant.name_tenants}/products_images;`
const uploadPromises = req.files.map((file) => uploadImageToGCS(file, folderName));
const newPictureUrls = await Promise.all(uploadPromises);
pictureUrls = [...pictureUrls, ...newPictureUrls];
Expand Down

0 comments on commit ba8c7ba

Please sign in to comment.