Fixed bug
This commit is contained in:
parent
9dc6c5385f
commit
f67c8e0167
1 changed files with 6 additions and 6 deletions
|
@ -2,7 +2,7 @@ const models = require('../models')
|
||||||
const vegetableTypes = models.vegetableTypes
|
const vegetableTypes = models.vegetableTypes
|
||||||
|
|
||||||
class VegetableTypes {
|
class VegetableTypes {
|
||||||
static getAll (req, callback) {
|
static getAll(req, callback) {
|
||||||
vegetableTypes.findAndCountAll({
|
vegetableTypes.findAndCountAll({
|
||||||
order: [
|
order: [
|
||||||
['name', 'ASC']
|
['name', 'ASC']
|
||||||
|
@ -24,7 +24,7 @@ class VegetableTypes {
|
||||||
let res = []
|
let res = []
|
||||||
|
|
||||||
for (let i = 0; i < items.rows.length; i += 1) {
|
for (let i = 0; i < items.rows.length; i += 1) {
|
||||||
let type = items[i].rows.toJSON()
|
let type = items.rows[i].toJSON()
|
||||||
let vegetables = []
|
let vegetables = []
|
||||||
|
|
||||||
for (let j = 0; j < type.Vegetables.length; j += 1) {
|
for (let j = 0; j < type.Vegetables.length; j += 1) {
|
||||||
|
@ -49,7 +49,7 @@ class VegetableTypes {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
createOne (req, callback) {
|
createOne(req, callback) {
|
||||||
vegetableTypes.create(req.body)
|
vegetableTypes.create(req.body)
|
||||||
.then(item => {
|
.then(item => {
|
||||||
callback(null, item)
|
callback(null, item)
|
||||||
|
@ -59,7 +59,7 @@ class VegetableTypes {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static getOne (req, callback) {
|
static getOne(req, callback) {
|
||||||
vegetableTypes.findById(
|
vegetableTypes.findById(
|
||||||
req.params.vegetableTypesId,
|
req.params.vegetableTypesId,
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ class VegetableTypes {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
patchOne (req, callback) {
|
patchOne(req, callback) {
|
||||||
VegetableTypes.getOne(req, (err, item) => {
|
VegetableTypes.getOne(req, (err, item) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
callback(err, item)
|
callback(err, item)
|
||||||
|
@ -100,7 +100,7 @@ class VegetableTypes {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteOne (req, callback) {
|
deleteOne(req, callback) {
|
||||||
VegetableTypes.getOne(req, (err, item) => {
|
VegetableTypes.getOne(req, (err, item) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
callback(err, item)
|
callback(err, item)
|
||||||
|
|
Loading…
Reference in a new issue