Bhaskar 7 months ago
commit b9438b9322

@ -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})

@ -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",

Loading…
Cancel
Save