|
|
@ -1302,6 +1302,7 @@ exports.updateSensorQC = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getSensorsByStatus = async (req, reply) => {
|
|
|
|
exports.getSensorsByStatus = async (req, reply) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const { storeId } = req.params;
|
|
|
|
const { storeId } = req.params;
|
|
|
@ -1312,8 +1313,15 @@ exports.getSensorsByStatus = async (req, reply) => {
|
|
|
|
for (const status of statuses) {
|
|
|
|
for (const status of statuses) {
|
|
|
|
result[status] = await Insensors.find({ storeId, status });
|
|
|
|
result[status] = await Insensors.find({ storeId, status });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const sensorStock = await SensorStock.find({ storeId }).lean();
|
|
|
|
return reply.code(200).send(result);
|
|
|
|
return reply.code(200).send({
|
|
|
|
|
|
|
|
status_code: 200,
|
|
|
|
|
|
|
|
message: "Sensors and stock fetched successfully",
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
sensors: result,
|
|
|
|
|
|
|
|
stock: sensorStock
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
console.error("Error fetching sensors:", error);
|
|
|
|
console.error("Error fetching sensors:", error);
|
|
|
|
return reply.code(500).send({ message: "Internal Server Error" });
|
|
|
|
return reply.code(500).send({ message: "Internal Server Error" });
|
|
|
@ -1325,6 +1333,9 @@ exports.getSensorsByStatus = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getpumpswitchqc = async (req, reply) => {
|
|
|
|
exports.getpumpswitchqc = async (req, reply) => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
await MotorSwitchSensor.find({storeId: req.params.storeId,motorId:req.body.motorId})
|
|
|
|
await MotorSwitchSensor.find({storeId: req.params.storeId,motorId:req.body.motorId})
|
|
|
|