get qc pump switch

master
varun 1 year ago
parent a0a907a9a5
commit 9b92e3b12e

@ -850,4 +850,20 @@ exports.installmotorswitch = async (request, reply) => {
console.error(error);
return reply.status(500).send({ error: 'An error occurred while updating the sensor' });
}
};
};
exports.getpumpswitchqc = async (req, reply) => {
try {
await MotorSwitchSensor.find({storeId: req.params.storeId,motorId:req.body.motorId})
.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);
}
};

@ -501,6 +501,38 @@ fastify.post("/api/qccheckpumpswitch/:motorId", {
})
fastify.put("/api/getpumpswitchqc/:storeId", {
schema: {
tags: ["Store-Data"],
description: "This is to Get Quality Check Details Of Motor Switch",
summary: "This is to Get Quality Details Of Motor Switch",
params: {
required: ["storeId"],
type: "object",
properties: {
storeId: {
type: "string",
description: "storeId",
},
},
},
body: {
type: "object",
properties: {
motorId: { type: "string" },
},
},
security: [
{
basicAuth: [],
},
],
},
// preHandler: fastify.auth([fastify.authenticate]),
handler: storeController.getpumpswitchqc,
});
fastify.post("/api/installmotorswitch/:storeId", {
schema: {

Loading…
Cancel
Save