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 {
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 })

@ -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", {

Loading…
Cancel
Save