Added: Handle invalid ID

This commit is contained in:
Llewellyn D'souza
2021-12-29 10:09:18 +05:30
parent e3271562d8
commit 2fec07c288

View File

@@ -65,6 +65,10 @@ module.exports = {
try {
const warehouseDetails = await Warehouse.findById(id);
if (!warehouseDetails) {
res.send({ success: false, message: "ID not found" });
return;
}
warehouseDetails.imageUrl = req.file.path;
await warehouseDetails.save();
res.send({ success: true, data: warehouseDetails });