getting hardware based on storeIds

master
varun 1 year ago
parent 7943ab4b19
commit 2b2dc44fdd

@ -544,3 +544,20 @@ exports.addStore = async (request, reply) => {
}
};
exports.getHardware = async (req, reply) => {
try {
await WaterLeverSensor.find({storeId: req.params.storeId})
.exec()
.then((docs) => {
reply.send({ status_code: 200, data: docs, count: docs.length });
})
.catch((err) => {
console.log(err);
reply.send({ error: err });
});
} catch (err) {
throw boom.boomify(err);
}
};

@ -187,5 +187,31 @@ fastify.post("/api/qccheckwaterlevelSensor/:hardwareId", {
})
fastify.get("/api/getHardware/:storeId", {
schema: {
tags: ["Tank"],
description: "This is Get Hardware Data",
summary: "This is to Hardware Tank Data",
params: {
required: ["storeId"],
type: "object",
properties: {
storeId: {
type: "string",
description: "storeId",
},
},
},
security: [
{
basicAuth: [],
},
],
},
// preHandler: fastify.auth([fastify.authenticate]),
handler: storeController.getHardware,
});
next();
};

@ -180,8 +180,8 @@ module.exports = function (fastify, opts, next) {
fastify.get("/api/getTanks", {
schema: {
tags: ["Tank"],
description: "This is for Get Tank Data",
summary: "This is for to Get Tank Data",
description: "This is to Get Tank Data",
summary: "This is to Get Tank Data",
querystring: {
customerId: {type: 'string'}
},

Loading…
Cancel
Save