fix: coerce numeric values for jsonpath operators in query builder

This commit is contained in:
M1 2026-03-16 13:08:05 +04:00
parent 612d32e9dc
commit ab2cbaa5cc
1 changed files with 2 additions and 1 deletions

View File

@ -74,7 +74,8 @@ class QueryBuilder {
});
}
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);
return isNaN(n) ? value : n;
}