From f67c8e01678c8d7d584ef908f408072e110e7490 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Thu, 11 Apr 2019 12:57:48 +0200 Subject: [PATCH] Fixed bug --- middleware/VegetableTypes.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/middleware/VegetableTypes.js b/middleware/VegetableTypes.js index 6ad6c10..05835c8 100644 --- a/middleware/VegetableTypes.js +++ b/middleware/VegetableTypes.js @@ -2,7 +2,7 @@ const models = require('../models') const vegetableTypes = models.vegetableTypes class VegetableTypes { - static getAll (req, callback) { + static getAll(req, callback) { vegetableTypes.findAndCountAll({ order: [ ['name', 'ASC'] @@ -24,7 +24,7 @@ class VegetableTypes { let res = [] for (let i = 0; i < items.rows.length; i += 1) { - let type = items[i].rows.toJSON() + let type = items.rows[i].toJSON() let vegetables = [] 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) .then(item => { callback(null, item) @@ -59,7 +59,7 @@ class VegetableTypes { }) } - static getOne (req, callback) { + static getOne(req, callback) { vegetableTypes.findById( req.params.vegetableTypesId, { @@ -83,7 +83,7 @@ class VegetableTypes { }) } - patchOne (req, callback) { + patchOne(req, callback) { VegetableTypes.getOne(req, (err, item) => { if (err) { callback(err, item) @@ -100,7 +100,7 @@ class VegetableTypes { }) } - deleteOne (req, callback) { + deleteOne(req, callback) { VegetableTypes.getOne(req, (err, item) => { if (err) { callback(err, item)