image for orders
This commit is contained in:
parent
bd1a54be8f
commit
8c23775362
@ -289,24 +289,24 @@ export const deleteImageFromCloudinary = async (req, res) => {
|
|||||||
const response = { result: "ok" }; // Mock response for testing
|
const response = { result: "ok" }; // Mock response for testing
|
||||||
if (response.result === "ok") {
|
if (response.result === "ok") {
|
||||||
// Step 2: Find the brand containing the image and update the database
|
// Step 2: Find the brand containing the image and update the database
|
||||||
// const brand = await BrandModel.findOne({
|
const brand = await BrandModel.findOne({
|
||||||
// "image.public_id": decodedPublicId,
|
"image.public_id": decodedPublicId,
|
||||||
// });
|
});
|
||||||
|
|
||||||
// if (!brand) {
|
if (!brand) {
|
||||||
// return res.status(404).json({
|
return res.status(404).json({
|
||||||
// success: false,
|
success: false,
|
||||||
// msg: "Brand not found with the given image!",
|
msg: "Brand not found with the given image!",
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Remove the image from the brand's image array
|
// Remove the image from the brand's image array
|
||||||
// brand.image = brand.image.filter(
|
brand.image = brand.image.filter(
|
||||||
// (img) => img.public_id !== decodedPublicId
|
(img) => img.public_id !== decodedPublicId
|
||||||
// );
|
);
|
||||||
|
|
||||||
// // Step 3: Save the updated brand document
|
// Step 3: Save the updated brand document
|
||||||
// await brand.save();
|
await brand.save();
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user