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: [