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 { class VegetableTypes {
static getAll (req, callback) { static getAll (req, callback) {
@ -6,7 +7,15 @@ class VegetableTypes {
order: [ order: [
['name', 'ASC'] ['name', 'ASC']
], ],
include: ['Vegetables'] include: [{
include: [{
model: models.Vegetables,
as: 'Vegetables',
order: [
['name', 'ASC']
]
}]
}]
}) })
.then(items => { .then(items => {
if (!items) { if (!items) {
@ -34,7 +43,13 @@ class VegetableTypes {
vegetableTypes.findById( vegetableTypes.findById(
req.params.vegetableTypesId, req.params.vegetableTypesId,
{ {
include: ['Vegetables'] include: [{
model: models.Vegetables,
as: 'Vegetables',
order: [
['name', 'ASC']
]
}]
}) })
.then(item => { .then(item => {
if (!item) { if (!item) {