diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index dc4659fd..671caf0a 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -1517,7 +1517,7 @@ exports.writeMotorStatus = async (req, reply) => { result = await Tank.findOneAndUpdate( { motor_id: motor_id }, - { $set: { motor_stop_status: "1" } } + { $set: { motor_status: status } } ); reply.send({ status_code: 200, message: `Motor ${motor_id} status updated to ${status}` }); diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index 0ea4c56c..aac91347 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -583,7 +583,7 @@ module.exports = function (fastify, opts, next) { required: ['motor_id', 'status'], properties: { motor_id: { type: 'string' }, - status: { type: 'string', enum: ['on', 'off'] }, + status: { type: 'string'}, current: { type: 'string' }, temp: { type: 'string' }, }, @@ -610,6 +610,8 @@ module.exports = function (fastify, opts, next) { }, // required: ['motor_id'], }, + + }, handler: tanksController.readMotorStatus