From f820e98db9861b4b9cc2b024f65b3944c5fc83d1 Mon Sep 17 00:00:00 2001 From: varun Date: Mon, 3 Jul 2023 08:18:57 -0400 Subject: [PATCH] create iot data --- src/controllers/tanksController.js | 1 - src/routes/tanksRoute.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 9387002d..72575968 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -982,7 +982,6 @@ exports.IotDevice = async (req, reply) => { // save the document to MongoDB await ottank.save(); - // get the latest document sorted in descending order of date and time const latestOttank = await IotData.findOne({ hardwareId }).sort({ date: -1, time: -1 }); diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index f3a84719..af20d261 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -355,6 +355,7 @@ module.exports = function (fastify, opts, next) { } } }, + required: ["hardwareId", "mode", "tanks"] }, security: [