|
|
|
@ -1183,7 +1183,7 @@ exports.updateSensorById = async (req, reply) => {
|
|
|
|
|
const filteredUpdateData = Object.keys(updateData)
|
|
|
|
|
.filter((key) => allowedFields.includes(key))
|
|
|
|
|
.reduce((obj, key) => {
|
|
|
|
|
obj[key] = key === "type" ? updateData[key].toLowerCase() : updateData[key];
|
|
|
|
|
obj[key] = key === "type" ? updateData[key].toUpperCase() : updateData[key];
|
|
|
|
|
return obj;
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
@ -1296,8 +1296,8 @@ const generateBatchNo = (type, hardwareIdCompany) => {
|
|
|
|
|
exports.createSensor = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const storeId = req.params.storeId;
|
|
|
|
|
const { indate, batchno, hardwareId_company, quantity, model, type } = req.body;
|
|
|
|
|
|
|
|
|
|
const { indate, batchno, hardwareId_company, quantity, model,type } = req.body;
|
|
|
|
|
const sensorType = type.toLowerCase();
|
|
|
|
|
let finalBatchNo = batchno;
|
|
|
|
|
|
|
|
|
|
if (batchno === 'New') {
|
|
|
|
@ -1322,7 +1322,7 @@ exports.createSensor = async (req, reply) => {
|
|
|
|
|
storeId,
|
|
|
|
|
model,
|
|
|
|
|
batchno: finalBatchNo,
|
|
|
|
|
type,
|
|
|
|
|
type: sensorType,
|
|
|
|
|
indate,
|
|
|
|
|
hardwareId_company
|
|
|
|
|
};
|
|
|
|
|