Archived
1
0
Fork 0

Fix command query on change state

This commit is contained in:
Ethanell 2020-05-30 17:09:44 +02:00
parent 7b3fca46d2
commit d537c47cbf
3 changed files with 3 additions and 3 deletions

View file

@ -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;

View file

@ -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");

View file

@ -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");