fix: coerce numeric values for jsonpath operators in query builder
This commit is contained in:
parent
612d32e9dc
commit
ab2cbaa5cc
|
|
@ -74,7 +74,8 @@ class QueryBuilder {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const fieldDef = FIELDS.find(f => f.name === field);
|
const fieldDef = FIELDS.find(f => f.name === field);
|
||||||
if (fieldDef?.type === 'number') {
|
const numericOps = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte'];
|
||||||
|
if (fieldDef?.type === 'number' || (numericOps.includes(operator) && fieldDef?.type === 'jsonpath')) {
|
||||||
const n = Number(value);
|
const n = Number(value);
|
||||||
return isNaN(n) ? value : n;
|
return isNaN(n) ? value : n;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue