diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index a161f5bc..1f165a84 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 3d9a2584..3f4e4ea4 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"],