Updated default order for vegetables in types
This commit is contained in:
parent
faaee98022
commit
e00a165ce2
1 changed files with 18 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
|||
const vegetableTypes = require('../models').vegetableTypes
|
||||
const models = require('../models')
|
||||
const vegetableTypes = models.vegetableTypes
|
||||
|
||||
class VegetableTypes {
|
||||
static getAll (req, callback) {
|
||||
|
@ -6,7 +7,15 @@ class VegetableTypes {
|
|||
order: [
|
||||
['name', 'ASC']
|
||||
],
|
||||
include: ['Vegetables']
|
||||
include: [{
|
||||
include: [{
|
||||
model: models.Vegetables,
|
||||
as: 'Vegetables',
|
||||
order: [
|
||||
['name', 'ASC']
|
||||
]
|
||||
}]
|
||||
}]
|
||||
})
|
||||
.then(items => {
|
||||
if (!items) {
|
||||
|
@ -34,7 +43,13 @@ class VegetableTypes {
|
|||
vegetableTypes.findById(
|
||||
req.params.vegetableTypesId,
|
||||
{
|
||||
include: ['Vegetables']
|
||||
include: [{
|
||||
model: models.Vegetables,
|
||||
as: 'Vegetables',
|
||||
order: [
|
||||
['name', 'ASC']
|
||||
]
|
||||
}]
|
||||
})
|
||||
.then(item => {
|
||||
if (!item) {
|
||||
|
|
Loading…
Reference in a new issue