diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index da543b12..f139d20c 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -2772,6 +2772,7 @@ exports.IotDeviceforstandalone = async (req, reply) => { // save the document to MongoDB await ottank.save(); + // Delete excess records (keep only the latest three records) const recordsToKeep = 3; const recordsToDelete = await IotData.find({ hardwareId }) @@ -2825,7 +2826,7 @@ exports.IotDeviceforstandalone = async (req, reply) => { } const status = req.body.Motor_status; - console.log(hardwareId) + // Find the tank that contains the specified motor_id in its inputConnections const tank = await Tank.findOne({ "connections.inputConnections.motor_id": hardwareId }); diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index bc597103..c2d6d77e 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -522,6 +522,7 @@ module.exports = function (fastify, opts, next) { + fastify.get("/api/APIRead", { schema: {