From 7b3fca46d2eb5681ebab0effc5bc14131dc1cd74 Mon Sep 17 00:00:00 2001 From: flifloo Date: Sat, 30 May 2020 17:02:17 +0200 Subject: [PATCH] Some order on list --- sockets/listDessert.js | 4 +++- sockets/listDish.js | 4 +++- sockets/listDrink.js | 4 +++- sockets/listIngredient.js | 4 +++- sockets/listSauce.js | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sockets/listDessert.js b/sockets/listDessert.js index 91ff322..fb23272 100644 --- a/sockets/listDessert.js +++ b/sockets/listDessert.js @@ -3,7 +3,9 @@ const models = require("../models"); module.exports = socket => { return async () => { let desserts = [] - for (let i of await models.Dessert.findAll()) { + for (let i of await models.Dessert.findAll({ + order: ["name"] + })) { desserts.push({ id: i.id, name: i.name, diff --git a/sockets/listDish.js b/sockets/listDish.js index 690d029..079a4d9 100644 --- a/sockets/listDish.js +++ b/sockets/listDish.js @@ -3,7 +3,9 @@ const models = require("../models"); module.exports = socket => { return async () => { let dishes = [] - for (let d of await models.Dish.findAll()) { + for (let d of await models.Dish.findAll({ + order: ["name"] + })) { dishes.push({ id: d.id, name: d.name, diff --git a/sockets/listDrink.js b/sockets/listDrink.js index a10258b..8581241 100644 --- a/sockets/listDrink.js +++ b/sockets/listDrink.js @@ -3,7 +3,9 @@ const models = require("../models"); module.exports = socket => { return async () => { let drinks = [] - for (let i of await models.Drink.findAll()) { + for (let i of await models.Drink.findAll({ + order: ["name"] + })) { drinks.push({ id: i.id, name: i.name, diff --git a/sockets/listIngredient.js b/sockets/listIngredient.js index e20cc4f..e1be04a 100644 --- a/sockets/listIngredient.js +++ b/sockets/listIngredient.js @@ -3,7 +3,9 @@ const models = require("../models"); module.exports = socket => { return async () => { let ingredients = [] - for (let i of await models.Ingredient.findAll()) { + for (let i of await models.Ingredient.findAll({ + order: ["name"] + })) { ingredients.push({ id: i.id, name: i.name, diff --git a/sockets/listSauce.js b/sockets/listSauce.js index 604fab6..a4b6582 100644 --- a/sockets/listSauce.js +++ b/sockets/listSauce.js @@ -3,7 +3,9 @@ const models = require("../models"); module.exports = socket => { return async () => { let sauces = [] - for (let d of await models.Sauce.findAll()) { + for (let d of await models.Sauce.findAll({ + order: ["name"] + })) { sauces.push({ id: d.id, name: d.name,