Fix add command socket broadcast
This commit is contained in:
parent
14369ba8bc
commit
c4babbe5aa
2 changed files with 3 additions and 3 deletions
|
@ -25,11 +25,11 @@ module.exports = socket => {
|
||||||
for (let s of data.sauce)
|
for (let s of data.sauce)
|
||||||
await c.addSauce(await models.Sauce.findByPk(s));
|
await c.addSauce(await models.Sauce.findByPk(s));
|
||||||
if (data.drink)
|
if (data.drink)
|
||||||
await c.addDrink(await models.Drink.findByPk(data.drink));
|
await c.setDrink(await models.Drink.findByPk(data.drink));
|
||||||
if (data.dessert)
|
if (data.dessert)
|
||||||
await c.setDessert(await models.Dessert.findByPk(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.emit("new command", send);
|
||||||
socket.broadcast.emit("new command", send);
|
socket.broadcast.emit("new command", send);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const models = require("../models");
|
const models = require("../models");
|
||||||
|
|
||||||
function commandExport (c ) {
|
function commandExport (c) {
|
||||||
return {
|
return {
|
||||||
number: c.number,
|
number: c.number,
|
||||||
sandwich: c.sandwich ? c.sandwich.username : null,
|
sandwich: c.sandwich ? c.sandwich.username : null,
|
||||||
|
|
Reference in a new issue