diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index ec253f4c..f01e89fc 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -1477,8 +1477,10 @@ exports.motorstatus = async (req, reply) => { }; + exports.readMotorStatus = async (req, reply) => { try { + const motor_id = req.query.motor_id; // Perform any necessary logic based on action (1: Start, 2: Stop) @@ -1495,7 +1497,9 @@ exports.readMotorStatus = async (req, reply) => { } }; + exports.writeMotorStatus = async (req, reply) => { + try { const { motor_id, status, current, temp } = req.body; diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index ddd6d096..0ea4c56c 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -592,9 +592,11 @@ module.exports = function (fastify, opts, next) { }, handler: tanksController.writeMotorStatus + }); + fastify.get('/api/motor/read', { schema: { tags: ["Tank"],