change in write motor status

master
varun 2 years ago
parent 5392fa0162
commit 19a2b92b79

@ -1517,7 +1517,7 @@ exports.writeMotorStatus = async (req, reply) => {
result = await Tank.findOneAndUpdate( result = await Tank.findOneAndUpdate(
{ motor_id: motor_id }, { 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}` }); reply.send({ status_code: 200, message: `Motor ${motor_id} status updated to ${status}` });

@ -583,7 +583,7 @@ module.exports = function (fastify, opts, next) {
required: ['motor_id', 'status'], required: ['motor_id', 'status'],
properties: { properties: {
motor_id: { type: 'string' }, motor_id: { type: 'string' },
status: { type: 'string', enum: ['on', 'off'] }, status: { type: 'string'},
current: { type: 'string' }, current: { type: 'string' },
temp: { type: 'string' }, temp: { type: 'string' },
}, },
@ -610,6 +610,8 @@ module.exports = function (fastify, opts, next) {
}, },
// required: ['motor_id'], // required: ['motor_id'],
}, },
}, },
handler: tanksController.readMotorStatus handler: tanksController.readMotorStatus

Loading…
Cancel
Save