From 9967ff4ac14cb87741166a814a40c7395c065d2f Mon Sep 17 00:00:00 2001 From: Varun Date: Mon, 2 Sep 2024 16:54:32 +0530 Subject: [PATCH] changes --- src/controllers/tanksController.js | 4 ++-- src/routes/tanksRoute.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index f139d20c..65ddd341 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -2749,7 +2749,7 @@ exports.IotDevice = async (req, reply) => { }; -exports.IotDeviceforstandalone = async (req, reply) => { +exports.IotDeviceforstandalonedevice = async (req, reply) => { try { const { hardwareId, Motor_status, tanks } = req.body; @@ -2772,7 +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 }) diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index c2d6d77e..4aebc5fe 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -487,10 +487,11 @@ module.exports = function (fastify, opts, next) { fastify.route({ method: "POST", url: "/api/APIWriteforstandalone", + schema: { tags: ["Tank"], description: "This is for creating an IOT Device for slave integrated in master", - summary: "this is to Create IOT Device for slave integrated in master", + summary: "this is to Create IOT Device for slave integrated in master", body: { type: "object", properties: { @@ -516,12 +517,12 @@ module.exports = function (fastify, opts, next) { } ] }, - handler: tanksController.IotDeviceforstandalone + handler: tanksController.IotDeviceforstandalonedevice }); - + fastify.get("/api/APIRead", {