changes in qc

master^2
Varun 7 months ago
parent 8996cfad0c
commit 15ca1da7de

@ -1301,7 +1301,7 @@ exports.deleteSensorById = async (req, reply) => {
exports.updateSensorQC = async (req, reply) => {
try {
const { _id } = req.params;
const { hardwareId } = req.params;
let updateData = req.body;
const allowedFields = ['qccheck', 'qcby', 'comment', 'status', 'quality_check_details'];
@ -1325,13 +1325,13 @@ exports.updateSensorQC = async (req, reply) => {
// Find the sensor by ID
const updatedSensor = await Insensors.findByIdAndUpdate(
_id,
hardwareId,
filteredUpdateData,
{ new: true }
);
if (!updatedSensor) {
return reply.code(404).send({ message: 'Sensor not found' });
return reply.code(409).send({ message: 'Sensor not found' });
}
// Update stock based on QC result

@ -1182,6 +1182,7 @@ fastify.post('/api/getSensorByHardwareId/:storeId', {
handler: storeController.getSensorByHardwareId,
});
fastify.post("/api/updateSensorById/:_id", {
schema: {
description: "Edit specific sensor fields",
@ -1213,16 +1214,16 @@ fastify.post("/api/updateSensorById/:_id", {
});
fastify.post('/api/updateSensorQC/:_id', {
fastify.post('/api/updateSensorQC/:hardwareId', {
schema: {
description: 'Edit specific sensor QC fields',
tags: ['Store-Data'],
summary: 'Update QC fields of a sensor',
params: {
required: ['_id'],
required: ['_ihardwareIdd'],
type: 'object',
properties: {
_id: { type: 'string', description: 'Sensor ID' },
hardwareId: { type: 'string', description: 'Sensor ID' },
},
},
body: {

Loading…
Cancel
Save