rez_core 5.0.108 → 5.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1228,30 +1228,34 @@ export class FilterService {
|
|
|
1228
1228
|
val: any,
|
|
1229
1229
|
key: string,
|
|
1230
1230
|
) {
|
|
1231
|
-
//
|
|
1232
|
-
|
|
1233
|
-
|
|
1231
|
+
// Convert value to array ALWAYS
|
|
1232
|
+
let arr: any[] = [];
|
|
1233
|
+
|
|
1234
|
+
if (Array.isArray(val)) {
|
|
1235
|
+
arr = val.map((v) => String(v));
|
|
1236
|
+
} else if (typeof val === 'string') {
|
|
1237
|
+
// convert "345,346" → ["345", "346"]
|
|
1238
|
+
arr = val.split(',').map((v) => v.trim());
|
|
1239
|
+
} else {
|
|
1240
|
+
throw new BadRequestException(`Invalid multiselect value for ${attr}`);
|
|
1234
1241
|
}
|
|
1235
1242
|
|
|
1236
|
-
//
|
|
1237
|
-
if (
|
|
1238
|
-
|
|
1239
|
-
`Value for multi-select must be an array for operator: ${op}`,
|
|
1240
|
-
);
|
|
1243
|
+
// Prevent empty IN ()
|
|
1244
|
+
if (arr.length === 0) {
|
|
1245
|
+
return { query: '1=1', params: {} };
|
|
1241
1246
|
}
|
|
1242
1247
|
|
|
1243
1248
|
switch (op) {
|
|
1244
1249
|
case 'equal':
|
|
1245
1250
|
return {
|
|
1246
|
-
// <-- FIX: use :...param expansion
|
|
1247
1251
|
query: `e.${attr}::text IN (:...${key})`,
|
|
1248
|
-
params: { [key]:
|
|
1252
|
+
params: { [key]: arr },
|
|
1249
1253
|
};
|
|
1250
1254
|
|
|
1251
1255
|
case 'not_equal':
|
|
1252
1256
|
return {
|
|
1253
1257
|
query: `e.${attr}::text NOT IN (:...${key})`,
|
|
1254
|
-
params: { [key]:
|
|
1258
|
+
params: { [key]: arr },
|
|
1255
1259
|
};
|
|
1256
1260
|
|
|
1257
1261
|
case 'contains':
|