Fix command query on change state
This commit is contained in:
parent
7b3fca46d2
commit
d537c47cbf
3 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Reference in a new issue