rez_core 2.1.102 → 2.1.104
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 +22 -2
- package/dist/module/listmaster/repository/list-master-items.repository.js.map +1 -1
- package/dist/module/listmaster/service/list-master.service.js +2 -1
- package/dist/module/listmaster/service/list-master.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 +27 -2
- package/src/module/listmaster/service/list-master.service.ts +2 -0
package/package.json
CHANGED
|
@@ -20,15 +20,40 @@ 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
|
+
const listMasterItem = await this.repo.find({
|
|
25
|
+
where: {
|
|
26
|
+
id: sort_by,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
let orderBy = {};
|
|
31
|
+
|
|
32
|
+
const listMasterSortBy = listMasterItem[0].value;
|
|
33
|
+
|
|
34
|
+
switch (listMasterSortBy) {
|
|
35
|
+
case 'az':
|
|
36
|
+
orderBy = { name: 'ASC' };
|
|
37
|
+
break;
|
|
38
|
+
case 'za':
|
|
39
|
+
orderBy = { name: 'DESC' };
|
|
40
|
+
break;
|
|
41
|
+
case 'custom':
|
|
42
|
+
orderBy = { sortindex: 'ASC' };
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
|
|
24
46
|
const items = await this.repo.find({
|
|
25
47
|
where: {
|
|
26
48
|
listtype: type,
|
|
27
49
|
organization_id: organizationId,
|
|
28
50
|
status: 'ACTIVE',
|
|
29
51
|
},
|
|
30
|
-
order: {
|
|
52
|
+
order: {
|
|
53
|
+
...orderBy,
|
|
54
|
+
},
|
|
31
55
|
});
|
|
56
|
+
|
|
32
57
|
return items.map((i) => ({ label: i.name, value: i.id }));
|
|
33
58
|
}
|
|
34
59
|
|
|
@@ -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
|
|
|
@@ -108,6 +109,7 @@ export class ListMasterService {
|
|
|
108
109
|
const applyCommonFilters = (qb: any, status?: number) => {
|
|
109
110
|
if (status) {
|
|
110
111
|
qb.where(`${tableName}.status = :status`, { status });
|
|
112
|
+
qb.orWhere(`${tableName}.status = 'Active'`);
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
if (loggedInUser?.level_type && loggedInUser?.level_id) {
|