Fixed bug on delete vegetable
This commit is contained in:
parent
219c2f449c
commit
faaee98022
1 changed files with 26 additions and 10 deletions
|
@ -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)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue