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 => {
|
module.exports = socket => {
|
||||||
return async (data) => {
|
return async (data) => {
|
||||||
try {
|
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)
|
if (!c)
|
||||||
throw new Error("Command not found");
|
throw new Error("Command not found");
|
||||||
c.done = null;
|
c.done = null;
|
||||||
|
|
|
@ -3,7 +3,7 @@ const models = require("../models");
|
||||||
module.exports = socket => {
|
module.exports = socket => {
|
||||||
return async (data) => {
|
return async (data) => {
|
||||||
try {
|
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)
|
if (!c)
|
||||||
throw new Error("Command not found");
|
throw new Error("Command not found");
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ const utils = require("./utils");
|
||||||
module.exports = socket => {
|
module.exports = socket => {
|
||||||
return async (data) => {
|
return async (data) => {
|
||||||
try {
|
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)
|
if (!c)
|
||||||
throw new Error("Command not found");
|
throw new Error("Command not found");
|
||||||
|
|
||||||
|
|
Reference in a new issue