rez_core 4.0.100 → 4.0.102
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/.idea/250218_nodejs_core.iml +12 -0
- package/.idea/codeStyles/Project.xml +59 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/dist/module/filter/service/filter.service.d.ts +2 -0
- package/dist/module/filter/service/filter.service.js +89 -81
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js +3 -2
- package/dist/module/meta/service/entity-dynamic.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 +198 -174
- package/src/module/meta/service/entity-dynamic.service.ts +2 -1
- package/.vscode/extensions.json +0 -5
package/package.json
CHANGED
|
@@ -28,53 +28,55 @@ export class FilterService {
|
|
|
28
28
|
private readonly skipAppCodeFilterEntities = ['ORGP'];
|
|
29
29
|
private readonly skipOrgFilterEntities = ['ORGP'];
|
|
30
30
|
|
|
31
|
-
|
|
32
31
|
private async gettab_value_counts(
|
|
33
32
|
tableName: string,
|
|
34
33
|
column: string | undefined,
|
|
35
34
|
whereClauses: { query: string; params: Record<string, any> }[],
|
|
36
35
|
) {
|
|
37
36
|
if (!column) return [];
|
|
38
|
-
|
|
37
|
+
|
|
39
38
|
let whereSQL = '';
|
|
40
39
|
const values: any[] = [];
|
|
41
|
-
|
|
40
|
+
|
|
42
41
|
if (whereClauses.length > 0) {
|
|
43
42
|
const clauseParts = whereClauses.map((clause) => {
|
|
44
43
|
let parsedQuery = clause.query.replace(/\be\./g, ''); // remove e.
|
|
45
|
-
|
|
44
|
+
|
|
46
45
|
Object.entries(clause.params).forEach(([key, val]) => {
|
|
47
46
|
if (Array.isArray(val)) {
|
|
48
47
|
// if it's an array → expand placeholders (?, ?, ?)
|
|
49
48
|
const placeholders = val.map(() => '?').join(', ');
|
|
50
|
-
parsedQuery = parsedQuery.replace(
|
|
49
|
+
parsedQuery = parsedQuery.replace(
|
|
50
|
+
new RegExp(`:${key}`, 'g'),
|
|
51
|
+
`(${placeholders})`,
|
|
52
|
+
);
|
|
51
53
|
values.push(...val); // flatten values
|
|
52
54
|
} else {
|
|
53
55
|
parsedQuery = parsedQuery.replace(new RegExp(`:${key}`, 'g'), '?');
|
|
54
56
|
values.push(val);
|
|
55
57
|
}
|
|
56
58
|
});
|
|
57
|
-
|
|
59
|
+
|
|
58
60
|
return parsedQuery;
|
|
59
61
|
});
|
|
60
|
-
|
|
62
|
+
|
|
61
63
|
whereSQL = `WHERE ${clauseParts.join(' AND ')}`;
|
|
62
64
|
}
|
|
63
|
-
|
|
65
|
+
|
|
64
66
|
const rawSQL = `
|
|
65
67
|
SELECT ${column} AS tab_value, COUNT(*) AS tab_value_count
|
|
66
68
|
FROM ${tableName}
|
|
67
69
|
${whereSQL}
|
|
68
70
|
GROUP BY ${column}
|
|
69
71
|
`;
|
|
70
|
-
|
|
72
|
+
|
|
71
73
|
const rows = await this.dataSource.query(rawSQL, values);
|
|
72
|
-
|
|
74
|
+
|
|
73
75
|
const total = rows.reduce(
|
|
74
76
|
(sum, r) => sum + parseInt(r.tab_value_count, 10),
|
|
75
77
|
0,
|
|
76
78
|
);
|
|
77
|
-
|
|
79
|
+
|
|
78
80
|
return [
|
|
79
81
|
{ tab_value: 'All', tab_value_count: total },
|
|
80
82
|
...rows.map((r) => ({
|
|
@@ -83,7 +85,6 @@ export class FilterService {
|
|
|
83
85
|
})),
|
|
84
86
|
];
|
|
85
87
|
}
|
|
86
|
-
|
|
87
88
|
|
|
88
89
|
async applyFilterWrapper(dto: FilterRequestDto) {
|
|
89
90
|
const {
|
|
@@ -265,25 +266,21 @@ export class FilterService {
|
|
|
265
266
|
),
|
|
266
267
|
];
|
|
267
268
|
|
|
268
|
-
// 🧱 Build where clauses
|
|
269
|
-
const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
|
|
269
|
+
// 🧱 Build where clauses
|
|
270
|
+
const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
|
|
270
271
|
|
|
271
|
-
// Handle TEMPLATE entity special condition
|
|
272
|
-
if (entity_type === 'TEMP' || entity_type === 'TEM') {
|
|
273
|
-
|
|
272
|
+
// Handle TEMPLATE entity special condition
|
|
273
|
+
if (entity_type === 'TEMP' || entity_type === 'TEM') {
|
|
274
|
+
const templateTable = entityMeta?.data_source || 'frm_wf_comm_template';
|
|
274
275
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
} else if (level_type === 'SCH') {
|
|
285
|
-
baseWhere.push({
|
|
286
|
-
query: `
|
|
276
|
+
if (level_type === 'ORG') {
|
|
277
|
+
baseWhere.push({
|
|
278
|
+
query: ` ((e.level_type = 'ORG' AND e.level_id = ${loggedInUser.organization_id} AND e.organization_id = ${loggedInUser.organization_id}))`,
|
|
279
|
+
params: {},
|
|
280
|
+
});
|
|
281
|
+
} else if (level_type === 'SCH') {
|
|
282
|
+
baseWhere.push({
|
|
283
|
+
query: `
|
|
287
284
|
(
|
|
288
285
|
(e.level_type = 'SCH' AND e.level_id = ${loggedInUser.level_id} AND e.organization_id = ${loggedInUser.organization_id})
|
|
289
286
|
OR
|
|
@@ -299,43 +296,35 @@ if (entity_type === 'TEMP' || entity_type === 'TEM') {
|
|
|
299
296
|
)
|
|
300
297
|
)
|
|
301
298
|
`,
|
|
302
|
-
|
|
303
|
-
|
|
299
|
+
params: {},
|
|
300
|
+
});
|
|
304
301
|
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// Default org/level clause — skip TEMPLATE entity
|
|
311
|
-
if (
|
|
312
|
-
entity_type !== 'ORGP' &&
|
|
313
|
-
entity_type !== 'TEMP' &&
|
|
314
|
-
entity_type !== 'TEM' && // ✅ skip TEMPLATE
|
|
315
|
-
level_type &&
|
|
316
|
-
level_id &&
|
|
317
|
-
organization_id &&
|
|
318
|
-
!customLevelType &&
|
|
319
|
-
!customLevelId
|
|
320
|
-
) {
|
|
321
|
-
baseWhere.push({
|
|
322
|
-
query:
|
|
323
|
-
'e.organization_id = :organization_id AND e.level_type = :level_type AND e.level_id = :level_id',
|
|
324
|
-
params: { organization_id, level_type, level_id },
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
302
|
+
}
|
|
330
303
|
|
|
304
|
+
// Default org/level clause — skip TEMPLATE entity
|
|
305
|
+
if (
|
|
306
|
+
entity_type !== 'ORGP' &&
|
|
307
|
+
entity_type !== 'TEMP' &&
|
|
308
|
+
entity_type !== 'TEM' && // ✅ skip TEMPLATE
|
|
309
|
+
level_type &&
|
|
310
|
+
level_id &&
|
|
311
|
+
organization_id &&
|
|
312
|
+
!customLevelType &&
|
|
313
|
+
!customLevelId
|
|
314
|
+
) {
|
|
315
|
+
baseWhere.push({
|
|
316
|
+
query:
|
|
317
|
+
'e.organization_id = :organization_id AND e.level_type = :level_type AND e.level_id = :level_id',
|
|
318
|
+
params: { organization_id, level_type, level_id },
|
|
319
|
+
});
|
|
320
|
+
}
|
|
331
321
|
|
|
332
|
-
if (entity_type ==
|
|
322
|
+
if (entity_type == 'USR' || entity_type == 'UPR') {
|
|
333
323
|
baseWhere.push({
|
|
334
324
|
query: 'e.is_customer is NULL',
|
|
335
325
|
params: {},
|
|
336
326
|
});
|
|
337
327
|
}
|
|
338
|
-
|
|
339
328
|
|
|
340
329
|
if (customLevelType && customLevelId && customAppCode) {
|
|
341
330
|
baseWhere.push({
|
|
@@ -385,82 +374,14 @@ if (
|
|
|
385
374
|
const layout = layoutPreference?.[0]?.mapped_json?.quick_tab || {};
|
|
386
375
|
const showList = layout?.show_list?.map((val) => val.toLowerCase()) || [];
|
|
387
376
|
|
|
388
|
-
let
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
allTabs = await this.gettab_value_counts(
|
|
397
|
-
entityMeta?.data_source,
|
|
398
|
-
tabs?.columnName,
|
|
399
|
-
baseWhere,
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
let filteredTabs;
|
|
404
|
-
|
|
405
|
-
if (showList?.length > 0) {
|
|
406
|
-
const isAllNeeded = layout?.isAllSelected && !showList.includes('all');
|
|
407
|
-
if (isAllNeeded) showList.push('all');
|
|
408
|
-
|
|
409
|
-
filteredTabs = allTabs.filter((tab) =>
|
|
410
|
-
showList.includes(tab.tab_value.toLowerCase()),
|
|
411
|
-
);
|
|
412
|
-
|
|
413
|
-
const allTab = filteredTabs.find(
|
|
414
|
-
(tab) => tab.tab_value?.toLowerCase() === 'all',
|
|
415
|
-
);
|
|
416
|
-
filteredTabs = filteredTabs.filter(
|
|
417
|
-
(tab) => tab.tab_value?.toLowerCase() !== 'all',
|
|
418
|
-
);
|
|
419
|
-
|
|
420
|
-
// SORTING LOGIC
|
|
421
|
-
if (layout.sorting === 'asc') {
|
|
422
|
-
filteredTabs.sort((a, b) =>
|
|
423
|
-
a.tab_value.toLowerCase().localeCompare(b.tab_value.toLowerCase()),
|
|
424
|
-
);
|
|
425
|
-
} else if (layout.sorting === 'dsc') {
|
|
426
|
-
filteredTabs.sort((a, b) =>
|
|
427
|
-
b.tab_value.toLowerCase().localeCompare(a.tab_value.toLowerCase()),
|
|
428
|
-
);
|
|
429
|
-
} else if (layout.sorting === 'count_asc') {
|
|
430
|
-
filteredTabs.sort((a, b) => a.tab_value_count - b.tab_value_count);
|
|
431
|
-
} else if (layout.sorting === 'count_dsc') {
|
|
432
|
-
filteredTabs.sort((a, b) => b.tab_value_count - a.tab_value_count);
|
|
433
|
-
} else if (layout.sorting === 'custom') {
|
|
434
|
-
const orderMap = new Map<string, number>(
|
|
435
|
-
showList.map((val, index) => [val.toLowerCase(), index]),
|
|
436
|
-
);
|
|
437
|
-
filteredTabs.sort((a, b) => {
|
|
438
|
-
const aIndex = orderMap.get(a.tab_value.toLowerCase()) ?? Infinity;
|
|
439
|
-
const bIndex = orderMap.get(b.tab_value.toLowerCase()) ?? Infinity;
|
|
440
|
-
return aIndex - bIndex;
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if (allTab) filteredTabs.unshift(allTab);
|
|
445
|
-
|
|
446
|
-
if (layout?.isCombineOther) {
|
|
447
|
-
const originalAllTab = allTabs.find(
|
|
448
|
-
(tab) => tab.tab_value.toLowerCase() === 'all',
|
|
449
|
-
);
|
|
450
|
-
const allCount = originalAllTab?.tab_value_count ?? 0;
|
|
451
|
-
const knownTabCountSum = filteredTabs
|
|
452
|
-
.filter((tab) => tab.tab_value.toLowerCase() !== 'all')
|
|
453
|
-
.reduce((acc, tab) => acc + tab.tab_value_count, 0);
|
|
454
|
-
|
|
455
|
-
const othersCount = allCount - knownTabCountSum;
|
|
456
|
-
filteredTabs.push({
|
|
457
|
-
tab_value: 'OTHERS',
|
|
458
|
-
tab_value_count: othersCount < 0 ? 0 : othersCount,
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
} else {
|
|
462
|
-
filteredTabs = allTabs;
|
|
463
|
-
}
|
|
377
|
+
let filteredTabs = await this.getFilteredTabs(
|
|
378
|
+
layout,
|
|
379
|
+
showList,
|
|
380
|
+
entityMeta,
|
|
381
|
+
baseWhere,
|
|
382
|
+
tabs,
|
|
383
|
+
loggedInUser,
|
|
384
|
+
);
|
|
464
385
|
|
|
465
386
|
const dataWhere = [...baseWhere];
|
|
466
387
|
|
|
@@ -515,51 +436,14 @@ if (
|
|
|
515
436
|
}
|
|
516
437
|
}
|
|
517
438
|
|
|
518
|
-
|
|
439
|
+
let qb = this.dataSource
|
|
519
440
|
.createQueryBuilder()
|
|
520
441
|
.select('e.*')
|
|
521
442
|
.from(tableName, 'e');
|
|
522
443
|
dataWhere.forEach((clause) => qb.andWhere(clause.query, clause.params));
|
|
523
444
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
const preferenceTabArray =
|
|
527
|
-
layoutPreference[0]?.mapped_json?.sorting?.tabs;
|
|
528
|
-
const tabFilter = preferenceTabArray.find(
|
|
529
|
-
(tabData) => tabData.tab_name === tabs?.value,
|
|
530
|
-
);
|
|
531
|
-
tabFilter?.sortby.forEach(({ column, order }) => {
|
|
532
|
-
qb.addOrderBy(
|
|
533
|
-
`e.${column}`,
|
|
534
|
-
order?.toUpperCase() === 'DSC' ? 'DESC' : 'ASC',
|
|
535
|
-
);
|
|
536
|
-
});
|
|
537
|
-
} else if (
|
|
538
|
-
Array.isArray(layoutPreference[0]?.mapped_json?.sorting?.sortby)
|
|
539
|
-
) {
|
|
540
|
-
layoutPreference[0]?.mapped_json?.sorting?.sortby?.forEach(
|
|
541
|
-
({ column, order }) => {
|
|
542
|
-
qb.addOrderBy(
|
|
543
|
-
`e.${column}`,
|
|
544
|
-
order?.toUpperCase() === 'DSC' ? 'DESC' : 'ASC',
|
|
545
|
-
);
|
|
546
|
-
},
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
if (Array.isArray(sortby) && sortby.length > 0) {
|
|
552
|
-
sortby.forEach(({ sortColum, sortType }) => {
|
|
553
|
-
if (sortColum) {
|
|
554
|
-
qb.addOrderBy(`e.${sortColum}`, sortType?.toUpperCase() === 'DSC' ? 'DESC' : 'ASC');
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
} else {
|
|
558
|
-
// fallback if no explicit sortby sent
|
|
559
|
-
qb.addOrderBy('e.created_date', 'DESC');
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
|
|
445
|
+
// Apply sorting
|
|
446
|
+
qb = await this.sortTabsByShowList(qb, sortby, layoutPreference, tabs);
|
|
563
447
|
|
|
564
448
|
const page = dto.page && dto.page > 0 ? dto.page : 1;
|
|
565
449
|
const size = dto.size && dto.size > 0 ? dto.size : 10;
|
|
@@ -645,6 +529,146 @@ if (
|
|
|
645
529
|
};
|
|
646
530
|
}
|
|
647
531
|
|
|
532
|
+
// GET FILTERED TABS LOGIC
|
|
533
|
+
private async getFilteredTabs(
|
|
534
|
+
layout: any,
|
|
535
|
+
showList: any,
|
|
536
|
+
entityMeta: any,
|
|
537
|
+
baseWhere: any,
|
|
538
|
+
tabs: any,
|
|
539
|
+
loggedInUser: any,
|
|
540
|
+
) {
|
|
541
|
+
let allTabs;
|
|
542
|
+
if (layout.attribute) {
|
|
543
|
+
allTabs = await this.gettab_value_counts(
|
|
544
|
+
entityMeta?.data_source,
|
|
545
|
+
layout.attribute,
|
|
546
|
+
baseWhere,
|
|
547
|
+
);
|
|
548
|
+
} else {
|
|
549
|
+
allTabs = await this.gettab_value_counts(
|
|
550
|
+
entityMeta?.data_source,
|
|
551
|
+
tabs?.columnName,
|
|
552
|
+
baseWhere,
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
let filteredTabs: any[] = [];
|
|
557
|
+
|
|
558
|
+
if (showList?.length > 0) {
|
|
559
|
+
const isAllNeeded = layout?.isAllSelected && !showList.includes('all');
|
|
560
|
+
if (isAllNeeded) showList.push('all');
|
|
561
|
+
|
|
562
|
+
filteredTabs = allTabs.filter((tab) =>
|
|
563
|
+
showList.includes(tab.tab_value.toLowerCase()),
|
|
564
|
+
);
|
|
565
|
+
|
|
566
|
+
const allTab = filteredTabs.find(
|
|
567
|
+
(tab) => tab.tab_value?.toLowerCase() === 'all',
|
|
568
|
+
);
|
|
569
|
+
filteredTabs = filteredTabs.filter(
|
|
570
|
+
(tab) => tab.tab_value?.toLowerCase() !== 'all',
|
|
571
|
+
);
|
|
572
|
+
|
|
573
|
+
// SORTING LOGIC
|
|
574
|
+
if (layout.sorting === 'asc') {
|
|
575
|
+
filteredTabs.sort((a, b) =>
|
|
576
|
+
a.tab_value.toLowerCase().localeCompare(b.tab_value.toLowerCase()),
|
|
577
|
+
);
|
|
578
|
+
} else if (layout.sorting === 'dsc') {
|
|
579
|
+
filteredTabs.sort((a, b) =>
|
|
580
|
+
b.tab_value.toLowerCase().localeCompare(a.tab_value.toLowerCase()),
|
|
581
|
+
);
|
|
582
|
+
} else if (layout.sorting === 'count_asc') {
|
|
583
|
+
filteredTabs.sort((a, b) => a.tab_value_count - b.tab_value_count);
|
|
584
|
+
} else if (layout.sorting === 'count_dsc') {
|
|
585
|
+
filteredTabs.sort((a, b) => b.tab_value_count - a.tab_value_count);
|
|
586
|
+
} else if (layout.sorting === 'custom') {
|
|
587
|
+
const orderMap = new Map<string, number>(
|
|
588
|
+
showList.map((val, index) => [val.toLowerCase(), index]),
|
|
589
|
+
);
|
|
590
|
+
filteredTabs.sort((a, b) => {
|
|
591
|
+
const aIndex = orderMap.get(a.tab_value.toLowerCase()) ?? Infinity;
|
|
592
|
+
const bIndex = orderMap.get(b.tab_value.toLowerCase()) ?? Infinity;
|
|
593
|
+
return aIndex - bIndex;
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
if (allTab) filteredTabs.unshift(allTab);
|
|
598
|
+
|
|
599
|
+
if (layout?.isCombineOther) {
|
|
600
|
+
const originalAllTab = allTabs.find(
|
|
601
|
+
(tab) => tab.tab_value.toLowerCase() === 'all',
|
|
602
|
+
);
|
|
603
|
+
const allCount = originalAllTab?.tab_value_count ?? 0;
|
|
604
|
+
const knownTabCountSum = filteredTabs
|
|
605
|
+
.filter((tab) => tab.tab_value.toLowerCase() !== 'all')
|
|
606
|
+
.reduce((acc, tab) => acc + tab.tab_value_count, 0);
|
|
607
|
+
|
|
608
|
+
const othersCount = allCount - knownTabCountSum;
|
|
609
|
+
filteredTabs.push({
|
|
610
|
+
tab_value: 'OTHERS',
|
|
611
|
+
tab_value_count: othersCount < 0 ? 0 : othersCount,
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
} else {
|
|
615
|
+
filteredTabs = allTabs;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
return filteredTabs;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// SORTING LOGIC FOR TABS
|
|
622
|
+
private async sortTabsByShowList(
|
|
623
|
+
qb: any,
|
|
624
|
+
sortby: any,
|
|
625
|
+
layoutPreference: any,
|
|
626
|
+
tabs: any,
|
|
627
|
+
) {
|
|
628
|
+
if (layoutPreference && layoutPreference[0]?.mapped_json?.sorting) {
|
|
629
|
+
if (Array.isArray(layoutPreference[0]?.mapped_json?.sorting?.tabs)) {
|
|
630
|
+
const preferenceTabArray =
|
|
631
|
+
layoutPreference[0]?.mapped_json?.sorting?.tabs;
|
|
632
|
+
const tabFilter = preferenceTabArray.find(
|
|
633
|
+
(tabData) => tabData.tab_name === tabs?.value,
|
|
634
|
+
);
|
|
635
|
+
tabFilter?.sortby.forEach(({ column, order }) => {
|
|
636
|
+
qb.addOrderBy(
|
|
637
|
+
`e.${column}`,
|
|
638
|
+
order?.toUpperCase() === 'DSC' ? 'DESC' : 'ASC',
|
|
639
|
+
);
|
|
640
|
+
});
|
|
641
|
+
} else if (
|
|
642
|
+
Array.isArray(layoutPreference[0]?.mapped_json?.sorting?.sortby)
|
|
643
|
+
) {
|
|
644
|
+
layoutPreference[0]?.mapped_json?.sorting?.sortby?.forEach(
|
|
645
|
+
({ column, order }) => {
|
|
646
|
+
qb.addOrderBy(
|
|
647
|
+
`e.${column}`,
|
|
648
|
+
order?.toUpperCase() === 'DSC' ? 'DESC' : 'ASC',
|
|
649
|
+
);
|
|
650
|
+
},
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
if (Array.isArray(sortby) && sortby.length > 0) {
|
|
656
|
+
sortby.forEach(({ sortColum, sortType }) => {
|
|
657
|
+
if (sortColum) {
|
|
658
|
+
qb.addOrderBy(
|
|
659
|
+
`e.${sortColum}`,
|
|
660
|
+
sortType?.toUpperCase() === 'DSC' ? 'DESC' : 'ASC',
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
} else {
|
|
665
|
+
// fallback if no explicit sortby sent
|
|
666
|
+
qb.addOrderBy('e.created_date', 'DESC');
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
return qb;
|
|
670
|
+
}
|
|
671
|
+
|
|
648
672
|
private parseFilters(raw: any, isSingle = false): any[] {
|
|
649
673
|
if (!raw) return [];
|
|
650
674
|
|
|
@@ -538,6 +538,7 @@ export class EntityDynamicService {
|
|
|
538
538
|
const validAttributes = await this.getAttributeCodes(
|
|
539
539
|
entityType,
|
|
540
540
|
organizationId,
|
|
541
|
+
false,
|
|
541
542
|
);
|
|
542
543
|
|
|
543
544
|
const columns = validAttributes
|
|
@@ -590,7 +591,6 @@ export class EntityDynamicService {
|
|
|
590
591
|
const validAttributes = await this.getAttributeCodes(
|
|
591
592
|
entityType,
|
|
592
593
|
organizationId,
|
|
593
|
-
false,
|
|
594
594
|
);
|
|
595
595
|
|
|
596
596
|
const columns = validAttributes
|
|
@@ -676,6 +676,7 @@ export class EntityDynamicService {
|
|
|
676
676
|
.select('fea.attribute_key', 'attribute_key')
|
|
677
677
|
.addSelect('MAX(fea.db_datatype)', 'db_datatype')
|
|
678
678
|
.addSelect('MAX(fea.element_type)', 'element_type')
|
|
679
|
+
.addSelect('MAX(fea.is_hidden)', 'is_hidden')
|
|
679
680
|
.from('frm_entity_attribute', 'fea')
|
|
680
681
|
.where('fea.mapped_entity_type = :entityType', { entityType })
|
|
681
682
|
.andWhere('fea.organization_id = :organizationId', { organizationId });
|