rez_core 5.0.110 → 5.0.111
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
|
@@ -1222,65 +1222,54 @@ export class FilterService {
|
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
|
-
private buildMultiSelectCondition(
|
|
1226
|
-
|
|
1227
|
-
op: string,
|
|
1228
|
-
val: any,
|
|
1229
|
-
key: string,
|
|
1230
|
-
) {
|
|
1231
|
-
// Convert value to array ALWAYS
|
|
1232
|
-
let arr: any[] = [];
|
|
1225
|
+
private buildMultiSelectCondition(attr: string, op: string, val: any, key: string) {
|
|
1226
|
+
let arr: string[] = [];
|
|
1233
1227
|
|
|
1228
|
+
// SAFETY: Convert all to array
|
|
1234
1229
|
if (Array.isArray(val)) {
|
|
1235
|
-
arr = val.map(
|
|
1230
|
+
arr = val.map(v => String(v));
|
|
1236
1231
|
} else if (typeof val === 'string') {
|
|
1237
|
-
|
|
1238
|
-
arr = val.split(',').map((v) => v.trim());
|
|
1232
|
+
arr = val.split(',').map(v => v.trim());
|
|
1239
1233
|
} else {
|
|
1240
|
-
throw new BadRequestException(`Invalid multiselect value
|
|
1234
|
+
throw new BadRequestException(`Invalid multiselect value`);
|
|
1241
1235
|
}
|
|
1242
1236
|
|
|
1243
|
-
// Prevent empty IN ()
|
|
1244
1237
|
if (arr.length === 0) {
|
|
1245
1238
|
return { query: '1=1', params: {} };
|
|
1246
1239
|
}
|
|
1247
1240
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
case 'not_equal':
|
|
1256
|
-
return {
|
|
1257
|
-
query: `e.${attr}::text NOT IN (:...${key})`,
|
|
1258
|
-
params: { [key]: arr },
|
|
1259
|
-
};
|
|
1241
|
+
if (op === 'equal') {
|
|
1242
|
+
return {
|
|
1243
|
+
query: `e.${attr}::text IN (:...${key})`,
|
|
1244
|
+
params: { [key]: arr },
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1260
1247
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1248
|
+
if (op === 'not_equal') {
|
|
1249
|
+
return {
|
|
1250
|
+
query: `e.${attr}::text NOT IN (:...${key})`,
|
|
1251
|
+
params: { [key]: arr },
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1266
1254
|
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1255
|
+
if (op === 'contains') {
|
|
1256
|
+
return {
|
|
1257
|
+
query: `e.${attr}::text LIKE :${key}`,
|
|
1258
|
+
params: { [key]: `%${val}%` },
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1272
1261
|
|
|
1273
|
-
|
|
1274
|
-
|
|
1262
|
+
if (op === 'not_contains') {
|
|
1263
|
+
return {
|
|
1264
|
+
query: `e.${attr}::text NOT LIKE :${key}`,
|
|
1265
|
+
params: { [key]: `%${val}%` },
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1275
1268
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1269
|
+
if (op === 'empty') return { query: `e.${attr} IS NULL`, params: {} };
|
|
1270
|
+
if (op === 'not_empty') return { query: `e.${attr} IS NOT NULL`, params: {} };
|
|
1278
1271
|
|
|
1279
|
-
|
|
1280
|
-
throw new BadRequestException(
|
|
1281
|
-
`Unsupported operator for multiselect: ${op}`,
|
|
1282
|
-
);
|
|
1283
|
-
}
|
|
1272
|
+
throw new BadRequestException(`Unsupported operator: ${op}`);
|
|
1284
1273
|
}
|
|
1285
1274
|
|
|
1286
1275
|
private buildYearCondition(attr: string, op: string, val: any, key: string) {
|