WRITTEN GET MOTOR DATA OF PARTICULAR USER

master
varun 2 years ago
parent 127251e2eb
commit 4eab256817

@ -159,6 +159,23 @@ exports.getTank = async (req, reply) => {
// }
//};
exports.getTankmotordata = async (req, reply) => {
try {
await MotorData.find({customerId: req.query.customerId})
.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);
}
};
exports.updateTanklevels = async (req, reply) => {
try {
const customerId = req.params.customerId;

@ -543,6 +543,25 @@ module.exports = function (fastify, opts, next) {
preHandler: fastify.auth([fastify.authenticate]),
handler: tanksController.deletemotordatarecordsbefore7days,
});
fastify.get("/api/getTankmotordata", {
schema: {
tags: ["Tank"],
description: "This is for Get Tank Motor Data",
summary: "This is for to Get Tank Motor Data",
querystring: {
customerId: {type: 'string'}
},
security: [
{
basicAuth: [],
},
],
},
preHandler: fastify.auth([fastify.authenticate]),
handler: tanksController.getTankmotordata,
});
next();
}

Loading…
Cancel
Save