server v1.0.7

This commit is contained in:
2020-10-01 20:21:01 +02:00
parent 5d6c7d5e3f
commit 63c2fb88e0
6 changed files with 33 additions and 37 deletions

View File

@@ -14,6 +14,7 @@ export async function removeDish(dishId) {
const deletedDoc = await Dish.findByIdAndDelete(dishId).catch((e) => {
throw newError("Usunięcie dania nie powiodło się.", 500);
});
await deleteImage(deletedDoc.imgUrl);
await Restaurant.findByIdAndUpdate(deletedDoc.restaurantId, {
$pull: { dishes: dishId },
}).catch((error) => {