|
|
|
@ -1236,12 +1236,14 @@ exports.deleteSensorById = async (req, reply) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.updateSensorQC = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { _id } = req.params;
|
|
|
|
|
let updateData = req.body;
|
|
|
|
|
|
|
|
|
|
const allowedFields = ["qccheck", "qcby", "comment","status"];
|
|
|
|
|
const allowedFields = ["qccheck", "qcby", "comment", "status"];
|
|
|
|
|
|
|
|
|
|
// Filter only allowed fields
|
|
|
|
|
const filteredUpdateData = Object.keys(updateData)
|
|
|
|
@ -1251,6 +1253,12 @@ exports.updateSensorQC = async (req, reply) => {
|
|
|
|
|
return obj;
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
// Ensure qccheck is handled properly
|
|
|
|
|
if (filteredUpdateData.qccheck) {
|
|
|
|
|
const qccheckLower = filteredUpdateData.qccheck.toLowerCase();
|
|
|
|
|
filteredUpdateData.status = qccheckLower === "ok" ? "available" : "qcfailed";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update qccheckdate with the current date in "DD-MMM-YYYY - HH:MM" format
|
|
|
|
|
filteredUpdateData.qccheckdate = moment().format("DD-MMM-YYYY - HH:mm");
|
|
|
|
|
|
|
|
|
@ -1272,6 +1280,7 @@ exports.updateSensorQC = async (req, reply) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getSensorsByStatus = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { storeId } = req.params;
|
|
|
|
|