Updated default order for vegetables in types

This commit is contained in:
dbroqua 2019-04-11 12:28:09 +02:00
parent faaee98022
commit e00a165ce2

View file

@ -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) {