rez_core 1.1.0 → 1.1.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -100,11 +100,11 @@ export class FilterService {
100
100
  // Get and parse filters
101
101
  const savedFilters = await this.getSavedFilters(savedFilterCode);
102
102
  const baseFilters = [
103
- ...(quickFilter || []).filter(f => f.filter_value !== ""),
104
- ...savedFilters.filter(f => f.filter_value !== ""),
105
- ...(attributeFilter || []).filter(f => f.filter_value !== ""),
103
+ ...(quickFilter || []).filter((f) => f.filter_value !== ''),
104
+ ...savedFilters.filter((f) => f.filter_value !== ''),
105
+ ...(attributeFilter || []).filter((f) => f.filter_value !== ''),
106
106
  ];
107
-
107
+
108
108
  const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
109
109
 
110
110
  // Build query for tab counts (no tab.value filter here)
@@ -229,7 +229,7 @@ export class FilterService {
229
229
  case 'select':
230
230
  return this.buildSelectCondition(attr, op, val, key);
231
231
  case 'multiselect':
232
- return this.buildMultiSelectCondition(attr, val, key);
232
+ return this.buildMultiSelectCondition(attr, op, val, key);
233
233
  default:
234
234
  return null;
235
235
  }
@@ -310,18 +310,56 @@ export class FilterService {
310
310
  case 'equal':
311
311
  return { query: `e.${attr} = :${key}`, params: { [key]: val } };
312
312
 
313
+ case 'not_equal':
314
+ return { query: `e.${attr} != :${key}`, params: { [key]: val } };
315
+
316
+ case 'empty':
317
+ return { query: `e.${attr} IS NULL`, params: {} };
318
+
319
+ case 'not_empty':
320
+ return { query: `e.${attr} IS NOT NULL`, params: {} };
321
+
313
322
  default:
314
323
  throw new BadRequestException(`Unsupported operator for select: ${op}`);
315
324
  }
316
325
  }
317
326
 
318
- private buildMultiSelectCondition(attr: string, val: any[], key: string) {
319
- if (!Array.isArray(val)) {
320
- throw new BadRequestException(`Expected array for multiselect: ${attr}`);
327
+ private buildMultiSelectCondition(
328
+ attr: string,
329
+ op: string,
330
+ val: any,
331
+ key: string,
332
+ ) {
333
+ switch (op) {
334
+ case 'equal':
335
+ if (!Array.isArray(val)) {
336
+ throw new BadRequestException(
337
+ `Value for multi-select must be an array for operator: ${op}`,
338
+ );
339
+ }
340
+ return { query: `e.${attr} IN (:...${key})`, params: { [key]: val } };
341
+
342
+ case 'not_equal':
343
+ if (!Array.isArray(val)) {
344
+ throw new BadRequestException(
345
+ `Value for multi-select must be an array for operator: ${op}`,
346
+ );
347
+ }
348
+ return {
349
+ query: `e.${attr} NOT IN (:...${key})`,
350
+ params: { [key]: val },
351
+ };
352
+
353
+ case 'empty':
354
+ return { query: `e.${attr} IS NULL`, params: {} };
355
+
356
+ case 'not_empty':
357
+ return { query: `e.${attr} IS NOT NULL`, params: {} };
358
+
359
+ default:
360
+ throw new BadRequestException(
361
+ `Unsupported operator for multiselect: ${op}`,
362
+ );
321
363
  }
322
- return {
323
- query: `e.${attr} IN (:...${key})`,
324
- params: { [key]: val },
325
- };
326
364
  }
327
365
  }