rez_core 2.1.103 → 2.1.105
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/listmaster/repository/list-master-items.repository.d.ts +1 -1
- package/dist/module/listmaster/repository/list-master-items.repository.js +23 -2
- package/dist/module/listmaster/repository/list-master-items.repository.js.map +1 -1
- package/dist/module/listmaster/service/list-master.service.js +1 -1
- package/dist/module/listmaster/service/list-master.service.js.map +1 -1
- package/dist/module/meta/repository/entity-table-column.repository.d.ts +1 -1
- package/dist/module/meta/repository/entity-table-column.repository.js +3 -1
- package/dist/module/meta/repository/entity-table-column.repository.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/module/meta/service/entity-table-column.service.d.ts +1 -1
- package/dist/module/meta/service/entity-table-column.service.js +2 -2
- package/dist/module/meta/service/entity-table-column.service.js.map +1 -1
- package/dist/module/meta/service/entity-table.service.js +1 -1
- package/dist/module/meta/service/entity-table.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/listmaster/repository/list-master-items.repository.ts +30 -2
- package/src/module/listmaster/service/list-master.service.ts +2 -1
- package/src/module/meta/repository/entity-table-column.repository.ts +3 -0
- package/src/module/meta/service/entity-service-impl.service.ts +1 -0
- package/src/module/meta/service/entity-table-column.service.ts +2 -0
- package/src/module/meta/service/entity-table.service.ts +1 -0
package/package.json
CHANGED
|
@@ -20,15 +20,43 @@ export class ListMasterItemsRepository {
|
|
|
20
20
|
return this.repo.findOne({ where: { id } });
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async findItemsByType(type: string, organizationId?: number) {
|
|
23
|
+
async findItemsByType(type: string, sort_by?, organizationId?: number) {
|
|
24
|
+
let orderBy: Record<string, 'ASC' | 'DESC'> = {}; // no default sort unless specified
|
|
25
|
+
|
|
26
|
+
// Only proceed if sort_by is a valid number
|
|
27
|
+
if (typeof sort_by === 'number' && !isNaN(sort_by)) {
|
|
28
|
+
const listMasterItem = await this.repo.find({
|
|
29
|
+
where: { id: sort_by },
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const sortValue = listMasterItem?.[0]?.value;
|
|
33
|
+
|
|
34
|
+
if (sortValue) {
|
|
35
|
+
const listMasterSortBy = String(sortValue).toLowerCase();
|
|
36
|
+
|
|
37
|
+
switch (listMasterSortBy) {
|
|
38
|
+
case 'az':
|
|
39
|
+
orderBy = { name: 'ASC' };
|
|
40
|
+
break;
|
|
41
|
+
case 'za':
|
|
42
|
+
orderBy = { name: 'DESC' };
|
|
43
|
+
break;
|
|
44
|
+
case 'custom':
|
|
45
|
+
orderBy = { sortindex: 'ASC' };
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
24
51
|
const items = await this.repo.find({
|
|
25
52
|
where: {
|
|
26
53
|
listtype: type,
|
|
27
54
|
organization_id: organizationId,
|
|
28
55
|
status: 'ACTIVE',
|
|
29
56
|
},
|
|
30
|
-
order:
|
|
57
|
+
order: orderBy,
|
|
31
58
|
});
|
|
59
|
+
|
|
32
60
|
return items.map((i) => ({ label: i.name, value: i.id }));
|
|
33
61
|
}
|
|
34
62
|
|
|
@@ -73,6 +73,7 @@ export class ListMasterService {
|
|
|
73
73
|
case 'master':
|
|
74
74
|
return this.listItemsRepo.findItemsByType(
|
|
75
75
|
type,
|
|
76
|
+
config.sort_by,
|
|
76
77
|
loggedInUser?.organization_id,
|
|
77
78
|
);
|
|
78
79
|
|
|
@@ -107,7 +108,7 @@ export class ListMasterService {
|
|
|
107
108
|
|
|
108
109
|
const applyCommonFilters = (qb: any, status?: number) => {
|
|
109
110
|
if (status) {
|
|
110
|
-
qb.where(`${tableName}.status = :status`, { status }
|
|
111
|
+
qb.where(`${tableName}.status = :status`, { status });
|
|
111
112
|
qb.orWhere(`${tableName}.status = 'Active'`);
|
|
112
113
|
}
|
|
113
114
|
|
|
@@ -13,6 +13,7 @@ export class EntityTableColumnRepository {
|
|
|
13
13
|
async findByParentIdAndParentType(
|
|
14
14
|
parentId: number,
|
|
15
15
|
parentType: string,
|
|
16
|
+
organization_id,
|
|
16
17
|
isVisible?: boolean,
|
|
17
18
|
) {
|
|
18
19
|
if (isVisible) {
|
|
@@ -20,6 +21,7 @@ export class EntityTableColumnRepository {
|
|
|
20
21
|
where: {
|
|
21
22
|
parent_id: parentId,
|
|
22
23
|
parent_type: parentType,
|
|
24
|
+
organization_id: organization_id,
|
|
23
25
|
},
|
|
24
26
|
order: { col_position: 'ASC' },
|
|
25
27
|
});
|
|
@@ -29,6 +31,7 @@ export class EntityTableColumnRepository {
|
|
|
29
31
|
parent_id: parentId,
|
|
30
32
|
parent_type: parentType,
|
|
31
33
|
visible: '1',
|
|
34
|
+
organization_id: organization_id,
|
|
32
35
|
},
|
|
33
36
|
order: { col_position: 'ASC' },
|
|
34
37
|
});
|
|
@@ -356,6 +356,7 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
356
356
|
await this.entityTableColumnService.findByParentIdAndParentType(
|
|
357
357
|
entityTable.id,
|
|
358
358
|
entityTable.entity_type,
|
|
359
|
+
loggedInUser.organization_id,
|
|
359
360
|
);
|
|
360
361
|
|
|
361
362
|
sheet.headers = entityTableColumnList.map((col) => col.name);
|
|
@@ -24,6 +24,7 @@ export class EntityTableColumnService {
|
|
|
24
24
|
async findByParentIdAndParentType(
|
|
25
25
|
parentId: number,
|
|
26
26
|
parentType: string,
|
|
27
|
+
organization_id,
|
|
27
28
|
isVisible?: boolean,
|
|
28
29
|
) {
|
|
29
30
|
let entityTableColumns =
|
|
@@ -31,6 +32,7 @@ export class EntityTableColumnService {
|
|
|
31
32
|
parentId,
|
|
32
33
|
parentType,
|
|
33
34
|
isVisible,
|
|
35
|
+
organization_id,
|
|
34
36
|
);
|
|
35
37
|
return entityTableColumns;
|
|
36
38
|
}
|
|
@@ -95,6 +95,7 @@ export class EntityTableService {
|
|
|
95
95
|
await this.entityTableColumnRepository.findByParentIdAndParentType(
|
|
96
96
|
entityTable.id,
|
|
97
97
|
entityTable.entity_type,
|
|
98
|
+
loggedInUser.organization_id,
|
|
98
99
|
);
|
|
99
100
|
entityTableDto.operation_list = {
|
|
100
101
|
text: await this.listMasterService.getDropdownOptions(
|