From 9b92e3b12e39a4f710cbe89cd96886c41bbe4991 Mon Sep 17 00:00:00 2001 From: varun Date: Mon, 15 Jul 2024 03:36:31 -0400 Subject: [PATCH] get qc pump switch --- src/controllers/storeController.js | 18 ++++++++++++++++- src/routes/storeRoute.js | 32 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/controllers/storeController.js b/src/controllers/storeController.js index 0d030327..50088953 100644 --- a/src/controllers/storeController.js +++ b/src/controllers/storeController.js @@ -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' }); } -}; \ No newline at end of file +}; + +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); + } +}; diff --git a/src/routes/storeRoute.js b/src/routes/storeRoute.js index b5700d01..295cf49d 100644 --- a/src/routes/storeRoute.js +++ b/src/routes/storeRoute.js @@ -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: {