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 {
|
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) {
|
||||||
|
|
Loading…
Reference in a new issue