Open rithviknishad opened 1 year ago
can I work on this issue
So , I added this validation rules in the ./observationValidator.js
const getObservationsValidators = (path = "") => [
// other validation rules ...
body(`wavevalue`)
.optional()
.isNumeric()
.withMessage("value must be number.")
.custom((value, { req }) => {
const lowLimit = req.body[`${path}low-limit`];
const highLimit = req.body[`${path}high-limit`];
if (lowLimit && highLimit) {
if (value < lowLimit || value > highLimit) {
throw new Error(`value must be between ${lowLimit} and ${highLimit}.`);
}
}
return true;
}),
];
We need to validate the data passed to the
/update_observation
endpoint.For example:
If waveform values are beyond the
data-highlimit
ordata-lowlimit
they should be rejected.