rez_core 2.0.66 → 2.0.68
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/dist/module/filter/service/filter.service.d.ts +1 -0
- package/dist/module/filter/service/filter.service.js +28 -0
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.d.ts +1 -0
- package/dist/module/meta/service/entity-service-impl.service.js +8 -0
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/filter/service/filter.service.ts +29 -9
- package/src/module/meta/service/entity-service-impl.service.ts +17 -0
package/package.json
CHANGED
|
@@ -268,6 +268,8 @@ export class FilterService {
|
|
|
268
268
|
return this.buildSelectCondition(attr, op, val, key);
|
|
269
269
|
case 'multiselect':
|
|
270
270
|
return this.buildMultiSelectCondition(attr, op, val, key);
|
|
271
|
+
case 'year':
|
|
272
|
+
return this.buildYearCondition(attr, op, val, key);
|
|
271
273
|
default:
|
|
272
274
|
return null;
|
|
273
275
|
}
|
|
@@ -338,7 +340,6 @@ export class FilterService {
|
|
|
338
340
|
}
|
|
339
341
|
}
|
|
340
342
|
|
|
341
|
-
// this can be inproved
|
|
342
343
|
private buildSelectCondition(
|
|
343
344
|
attr: string,
|
|
344
345
|
op: string,
|
|
@@ -348,16 +349,12 @@ export class FilterService {
|
|
|
348
349
|
switch (op) {
|
|
349
350
|
case 'equal':
|
|
350
351
|
return { query: `e.${attr} = :${key}`, params: { [key]: val } };
|
|
351
|
-
|
|
352
352
|
case 'not_equal':
|
|
353
353
|
return { query: `e.${attr} != :${key}`, params: { [key]: val } };
|
|
354
|
-
|
|
355
354
|
case 'empty':
|
|
356
355
|
return { query: `e.${attr} IS NULL`, params: {} };
|
|
357
|
-
|
|
358
356
|
case 'not_empty':
|
|
359
357
|
return { query: `e.${attr} IS NOT NULL`, params: {} };
|
|
360
|
-
|
|
361
358
|
default:
|
|
362
359
|
throw new BadRequestException(`Unsupported operator for select: ${op}`);
|
|
363
360
|
}
|
|
@@ -385,23 +382,46 @@ export class FilterService {
|
|
|
385
382
|
query: `e.${attr} IN (:${key})`,
|
|
386
383
|
params: { [key]: val },
|
|
387
384
|
};
|
|
388
|
-
|
|
389
385
|
case 'not_equal':
|
|
390
386
|
return {
|
|
391
387
|
query: `e.${attr} NOT IN (:${key})`,
|
|
392
388
|
params: { [key]: val },
|
|
393
389
|
};
|
|
394
|
-
|
|
395
390
|
case 'empty':
|
|
396
391
|
return { query: `e.${attr} IS NULL`, params: {} };
|
|
397
|
-
|
|
398
392
|
case 'not_empty':
|
|
399
393
|
return { query: `e.${attr} IS NOT NULL`, params: {} };
|
|
400
|
-
|
|
401
394
|
default:
|
|
402
395
|
throw new BadRequestException(
|
|
403
396
|
`Unsupported operator for multiselect: ${op}`,
|
|
404
397
|
);
|
|
405
398
|
}
|
|
406
399
|
}
|
|
400
|
+
|
|
401
|
+
private buildYearCondition(attr: string, op: string, val: any, key: string) {
|
|
402
|
+
switch (op) {
|
|
403
|
+
case 'equal':
|
|
404
|
+
return {
|
|
405
|
+
query: `e.${attr} = :${key}`,
|
|
406
|
+
params: { [key]: parseInt(val, 10) },
|
|
407
|
+
};
|
|
408
|
+
case 'not_equal':
|
|
409
|
+
return {
|
|
410
|
+
query: `e.${attr} != :${key}`,
|
|
411
|
+
params: { [key]: parseInt(val, 10) },
|
|
412
|
+
};
|
|
413
|
+
case 'greater_than':
|
|
414
|
+
return {
|
|
415
|
+
query: `e.${attr} > :${key}`,
|
|
416
|
+
params: { [key]: parseInt(val, 10) },
|
|
417
|
+
};
|
|
418
|
+
case 'less_than':
|
|
419
|
+
return {
|
|
420
|
+
query: `e.${attr} < :${key}`,
|
|
421
|
+
params: { [key]: parseInt(val, 10) },
|
|
422
|
+
};
|
|
423
|
+
default:
|
|
424
|
+
throw new BadRequestException(`Unsupported operator for year: ${op}`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
407
427
|
}
|
|
@@ -132,6 +132,23 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
132
132
|
return await repoService.findOne({ where: { id: id } });
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
async getEntityDataAll(
|
|
136
|
+
entityType: string,
|
|
137
|
+
type: {},
|
|
138
|
+
): Promise<BaseEntity[] | null> {
|
|
139
|
+
const entityData = await this.entityMasterService.getEntityData(entityType);
|
|
140
|
+
|
|
141
|
+
const repoService = this.reflectionHelper.getRepoService(
|
|
142
|
+
entityData.entity_data_class,
|
|
143
|
+
);
|
|
144
|
+
if (!repoService) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
`Repository service not found for entityType: ${entityType}`,
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
return await repoService.find({ where: type });
|
|
150
|
+
}
|
|
151
|
+
|
|
135
152
|
async getEntityList(
|
|
136
153
|
entityType: string,
|
|
137
154
|
filters: Record<string, any> = {},
|