Fixed bug on delete vegetable

This commit is contained in:
dbroqua 2019-04-09 19:45:00 +02:00
parent 219c2f449c
commit faaee98022

View file

@ -84,6 +84,20 @@ class Vegetables {
}
_deleteOne (item, req, callback) {
models.vegetablePictures
.destroy({
where: {
vegetableId: req.params.vegetablesId
}
})
.then(() => {
models.vegetableProperties
.destroy({
where: {
vegetableId: req.params.vegetablesId
}
})
.then(() => {
vegetables.destroy({
where: {
id: req.params.vegetablesId
@ -97,6 +111,8 @@ class Vegetables {
callback(null, null)
})
})
})
.catch(e => {
callback(e, null)
})