Archived
1
0
Fork 0

Fix add command socket broadcast

This commit is contained in:
Ethanell 2020-05-30 16:58:43 +02:00
parent 14369ba8bc
commit c4babbe5aa
2 changed files with 3 additions and 3 deletions

View file

@ -25,11 +25,11 @@ module.exports = socket => {
for (let s of data.sauce)
await c.addSauce(await models.Sauce.findByPk(s));
if (data.drink)
await c.addDrink(await models.Drink.findByPk(data.drink));
await c.setDrink(await models.Drink.findByPk(data.drink));
if (data.dessert)
await c.setDessert(await models.Dessert.findByPk(data.dessert));
let send = utils.commandExport(c);
let send = utils.commandExport(await models.Command.findByPk(c.id, {include: [models.Dish, models.Ingredient, models.Sauce, models.Drink, models.Dessert, "client", "pc", "sandwich"]}));
socket.emit("new command", send);
socket.broadcast.emit("new command", send);
} catch (e) {

View file

@ -1,6 +1,6 @@
const models = require("../models");
function commandExport (c ) {
function commandExport (c) {
return {
number: c.number,
sandwich: c.sandwich ? c.sandwich.username : null,