diff --git a/sockets/clearCommand.js b/sockets/clearCommand.js index db5fbc6..e9ceaf6 100644 --- a/sockets/clearCommand.js +++ b/sockets/clearCommand.js @@ -4,7 +4,7 @@ const utils = require("./utils"); module.exports = socket => { return async (data) => { try { - let c = await models.Command.findByPk(data); + let c = await models.Command.findOne({where: {number: {[models.Sequelize.Op.eq]: data}, date: {[models.Sequelize.Op.eq]: new Date()}}}); if (!c) throw new Error("Command not found"); c.done = null; diff --git a/sockets/errorCommand.js b/sockets/errorCommand.js index 28f172e..8017a2f 100644 --- a/sockets/errorCommand.js +++ b/sockets/errorCommand.js @@ -3,7 +3,7 @@ const models = require("../models"); module.exports = socket => { return async (data) => { try { - let c = await models.Command.findByPk(data); + let c = await models.Command.findOne({where: {number: {[models.Sequelize.Op.eq]: data}, date: {[models.Sequelize.Op.eq]: new Date()}}}); if (!c) throw new Error("Command not found"); diff --git a/sockets/giveCommand.js b/sockets/giveCommand.js index 1b176af..880feb3 100644 --- a/sockets/giveCommand.js +++ b/sockets/giveCommand.js @@ -4,7 +4,7 @@ const utils = require("./utils"); module.exports = socket => { return async (data) => { try { - let c = await models.Command.findByPk(data); + let c = await models.Command.findOne({where: {number: {[models.Sequelize.Op.eq]: data}, date: {[models.Sequelize.Op.eq]: new Date()}}}); if (!c) throw new Error("Command not found");