diff --git a/src/controllers/storeController.js b/src/controllers/storeController.js index 170ca884..7f1936f6 100644 --- a/src/controllers/storeController.js +++ b/src/controllers/storeController.js @@ -1302,6 +1302,7 @@ exports.updateSensorQC = async (req, reply) => { + exports.getSensorsByStatus = async (req, reply) => { try { const { storeId } = req.params; @@ -1312,8 +1313,15 @@ exports.getSensorsByStatus = async (req, reply) => { for (const status of statuses) { result[status] = await Insensors.find({ storeId, status }); } - - return reply.code(200).send(result); + const sensorStock = await SensorStock.find({ storeId }).lean(); + return reply.code(200).send({ + status_code: 200, + message: "Sensors and stock fetched successfully", + data: { + sensors: result, + stock: sensorStock + } + }); } catch (error) { console.error("Error fetching sensors:", error); return reply.code(500).send({ message: "Internal Server Error" }); @@ -1325,6 +1333,9 @@ exports.getSensorsByStatus = async (req, reply) => { + + + exports.getpumpswitchqc = async (req, reply) => { try { await MotorSwitchSensor.find({storeId: req.params.storeId,motorId:req.body.motorId}) diff --git a/src/routes/storeRoute.js b/src/routes/storeRoute.js index dcb61bab..0aed3c70 100644 --- a/src/routes/storeRoute.js +++ b/src/routes/storeRoute.js @@ -1203,7 +1203,7 @@ fastify.get("/api/getSensorsByStatus/:storeId", { description: "Store ID", }, }, - + }, }, handler: storeController.getSensorsByStatus, @@ -1697,6 +1697,12 @@ fastify.get("/api/getPendingOrders", { }); + + + + + + fastify.post("/api/cart/hardwareItem", { schema: { description: "To add items to the Hardwarecart",