master
Varun 1 year ago
parent 88b272ee4a
commit 9967ff4ac1

@ -2749,7 +2749,7 @@ exports.IotDevice = async (req, reply) => {
}; };
exports.IotDeviceforstandalone = async (req, reply) => { exports.IotDeviceforstandalonedevice = async (req, reply) => {
try { try {
const { hardwareId, Motor_status, tanks } = req.body; const { hardwareId, Motor_status, tanks } = req.body;
@ -2772,7 +2772,7 @@ exports.IotDeviceforstandalone = async (req, reply) => {
// save the document to MongoDB // save the document to MongoDB
await ottank.save(); await ottank.save();
// Delete excess records (keep only the latest three records) // Delete excess records (keep only the latest three records)
const recordsToKeep = 3; const recordsToKeep = 3;
const recordsToDelete = await IotData.find({ hardwareId }) const recordsToDelete = await IotData.find({ hardwareId })

@ -487,10 +487,11 @@ module.exports = function (fastify, opts, next) {
fastify.route({ fastify.route({
method: "POST", method: "POST",
url: "/api/APIWriteforstandalone", url: "/api/APIWriteforstandalone",
schema: { schema: {
tags: ["Tank"], tags: ["Tank"],
description: "This is for creating an IOT Device for slave integrated in master", 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: { body: {
type: "object", type: "object",
properties: { properties: {
@ -516,12 +517,12 @@ module.exports = function (fastify, opts, next) {
} }
] ]
}, },
handler: tanksController.IotDeviceforstandalone handler: tanksController.IotDeviceforstandalonedevice
}); });
fastify.get("/api/APIRead", { fastify.get("/api/APIRead", {

Loading…
Cancel
Save