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) => { exports.updateSensorQC = async (req, reply) => {
try { try {
const { _id } = req.params; const { hardwareId } = req.params;
let updateData = req.body; let updateData = req.body;
const allowedFields = ['qccheck', 'qcby', 'comment', 'status', 'quality_check_details']; const allowedFields = ['qccheck', 'qcby', 'comment', 'status', 'quality_check_details'];
@ -1325,13 +1325,13 @@ exports.updateSensorQC = async (req, reply) => {
// Find the sensor by ID // Find the sensor by ID
const updatedSensor = await Insensors.findByIdAndUpdate( const updatedSensor = await Insensors.findByIdAndUpdate(
_id, hardwareId,
filteredUpdateData, filteredUpdateData,
{ new: true } { new: true }
); );
if (!updatedSensor) { 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 // Update stock based on QC result

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

Loading…
Cancel
Save