rez_core 3.1.168 → 3.1.169
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/meta/service/resolver.service.js +13 -8
- package/dist/module/meta/service/resolver.service.js.map +1 -1
- package/dist/module/notification/entity/notification.entity.d.ts +1 -0
- package/dist/module/notification/entity/notification.entity.js +4 -0
- package/dist/module/notification/entity/notification.entity.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/meta/service/resolver.service.ts +43 -18
- package/src/module/notification/entity/notification.entity.ts +3 -0
package/package.json
CHANGED
|
@@ -6,9 +6,11 @@ import { ListMasterService } from 'src/module/listmaster/service/list-master.ser
|
|
|
6
6
|
|
|
7
7
|
@Injectable()
|
|
8
8
|
export class ResolverService {
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(
|
|
10
|
+
private readonly dataSource: DataSource,
|
|
10
11
|
@Inject('ListMasterService')
|
|
11
|
-
private readonly listMasterService: ListMasterService
|
|
12
|
+
private readonly listMasterService: ListMasterService,
|
|
13
|
+
) {}
|
|
12
14
|
|
|
13
15
|
async getResolvedData(
|
|
14
16
|
loggedInUser: any,
|
|
@@ -19,37 +21,61 @@ export class ResolverService {
|
|
|
19
21
|
`SELECT * FROM cr_entity_attribute WHERE mapped_entity_type = ? AND organization_id = ?`,
|
|
20
22
|
[entityType, loggedInUser.organization_id],
|
|
21
23
|
);
|
|
22
|
-
|
|
24
|
+
|
|
23
25
|
const resolvedEntityData = { ...entityData };
|
|
24
|
-
|
|
26
|
+
|
|
25
27
|
for (const attr of attributeItems) {
|
|
26
28
|
const field = attr.attribute_key;
|
|
27
29
|
const codeValue = entityData[field];
|
|
28
|
-
|
|
30
|
+
|
|
29
31
|
if (!codeValue) continue;
|
|
30
|
-
|
|
32
|
+
|
|
31
33
|
// -------- ENTITY or MASTER via getDropdownOptions --------
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
+
if (
|
|
35
|
+
attr.data_source_type === 'entity' ||
|
|
36
|
+
attr.data_source_type === 'master'
|
|
37
|
+
) {
|
|
38
|
+
const type =
|
|
39
|
+
attr.data_source_type === 'entity'
|
|
40
|
+
? attr.datasource_list
|
|
41
|
+
: attr.list_type;
|
|
34
42
|
const params = {}; // you can pass any additional filters here
|
|
35
|
-
|
|
43
|
+
|
|
36
44
|
if (Array.isArray(codeValue)) {
|
|
37
45
|
const resolvedValues: string[] = [];
|
|
38
46
|
for (const code of codeValue) {
|
|
39
|
-
const options = await this.listMasterService.getDropdownOptions(
|
|
40
|
-
|
|
47
|
+
const options = await this.listMasterService.getDropdownOptions(
|
|
48
|
+
type,
|
|
49
|
+
params,
|
|
50
|
+
undefined,
|
|
51
|
+
loggedInUser,
|
|
52
|
+
);
|
|
53
|
+
const item = options.find(
|
|
54
|
+
(opt) => opt.id === code || opt.code === code,
|
|
55
|
+
);
|
|
41
56
|
resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
|
|
42
57
|
}
|
|
43
58
|
resolvedEntityData[field] = resolvedValues;
|
|
44
59
|
} else {
|
|
45
|
-
const options = await this.listMasterService.getDropdownOptions(
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
const options = await this.listMasterService.getDropdownOptions(
|
|
61
|
+
type,
|
|
62
|
+
params,
|
|
63
|
+
undefined,
|
|
64
|
+
loggedInUser,
|
|
65
|
+
);
|
|
66
|
+
const item = options.find(
|
|
67
|
+
(opt) => opt.id === codeValue || opt.code === codeValue,
|
|
68
|
+
);
|
|
69
|
+
resolvedEntityData[field] =
|
|
70
|
+
item?.[attr.data_source_attribute] ?? codeValue;
|
|
48
71
|
}
|
|
49
72
|
}
|
|
50
|
-
|
|
73
|
+
|
|
51
74
|
// -------- DATE / DATETIME --------
|
|
52
|
-
else if (
|
|
75
|
+
else if (
|
|
76
|
+
attr.element_type === 'date' ||
|
|
77
|
+
attr.element_type === 'datetime'
|
|
78
|
+
) {
|
|
53
79
|
const dateValue = moment(codeValue).utcOffset('+05:30'); // IST
|
|
54
80
|
if (dateValue.isValid()) {
|
|
55
81
|
resolvedEntityData[field] =
|
|
@@ -59,10 +85,9 @@ export class ResolverService {
|
|
|
59
85
|
}
|
|
60
86
|
}
|
|
61
87
|
}
|
|
62
|
-
|
|
88
|
+
|
|
63
89
|
return resolvedEntityData;
|
|
64
90
|
}
|
|
65
|
-
|
|
66
91
|
|
|
67
92
|
async getResolvedValue(
|
|
68
93
|
loggedInUser: UserData,
|
|
@@ -18,6 +18,9 @@ export class NotificationData extends BaseEntity {
|
|
|
18
18
|
@Column({ nullable: true })
|
|
19
19
|
mapped_entity_type: string;
|
|
20
20
|
|
|
21
|
+
@Column({ nullable: true })
|
|
22
|
+
task_id: number;
|
|
23
|
+
|
|
21
24
|
@Column({ name: 'is_read', type: 'boolean', default: false })
|
|
22
25
|
is_read: boolean;
|
|
23
26
|
}
|