changes in store qc

master^2
Varun 8 months ago
parent 57aa2b3a7f
commit 5c56322e19

@ -1240,7 +1240,7 @@ exports.updateSensorQC = async (req, reply) => {
const { _id } = req.params;
let updateData = req.body;
const allowedFields = ["qccheck", "qcby", "comments","status"];
const allowedFields = ["qccheck", "qcby", "comments", "status"];
// Filter only allowed fields
const filteredUpdateData = Object.keys(updateData)
@ -1253,6 +1253,11 @@ exports.updateSensorQC = async (req, reply) => {
// Update qccheckdate with the current date in "DD-MMM-YYYY - HH:MM" format
filteredUpdateData.qccheckdate = moment().format("DD-MMM-YYYY - HH:mm");
// Update status based on qccheck value
if (filteredUpdateData.qccheck) {
filteredUpdateData.status = filteredUpdateData.qccheck.toLowerCase() === "ok" ? "available" : "rejected";
}
const updatedSensor = await Insensors.findByIdAndUpdate(
_id,
filteredUpdateData,

@ -1181,7 +1181,7 @@ fastify.post("/api/updateSensorQC/:_id", {
qccheck: { type: "string", description: "QC check status" },
qcby: { type: "string", description: "QC checked by" },
comments: { type: "string", description: "QC comment" },
status: { type: "string" },
},
},
},

Loading…
Cancel
Save