rez_core 4.0.83 → 4.0.85
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/mapper/service/field-mapper.service.d.ts +1 -1
- package/dist/module/mapper/service/field-mapper.service.js +41 -36
- package/dist/module/mapper/service/field-mapper.service.js.map +1 -1
- package/dist/module/workflow/controller/comm-template.controller.d.ts +3 -1
- package/dist/module/workflow/controller/comm-template.controller.js +5 -3
- package/dist/module/workflow/controller/comm-template.controller.js.map +1 -1
- package/dist/module/workflow/service/comm-template.service.d.ts +1 -1
- package/dist/module/workflow/service/comm-template.service.js +3 -3
- package/dist/module/workflow/service/comm-template.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/mapper/service/field-mapper.service.ts +60 -54
- package/src/module/workflow/controller/comm-template.controller.ts +4 -2
- package/src/module/workflow/service/comm-template.service.ts +8 -4
package/package.json
CHANGED
|
@@ -93,6 +93,8 @@ export class FieldMapperService extends EntityServiceImpl {
|
|
|
93
93
|
userData: UserData,
|
|
94
94
|
inputJson?: Record<string, any>,
|
|
95
95
|
mappedEntities?: Record<string, any>,
|
|
96
|
+
overwrite?: boolean,
|
|
97
|
+
entity_data?: any
|
|
96
98
|
) {
|
|
97
99
|
// Fetch field mappings for this mapper
|
|
98
100
|
const fieldMappers =
|
|
@@ -129,65 +131,69 @@ export class FieldMapperService extends EntityServiceImpl {
|
|
|
129
131
|
userData,
|
|
130
132
|
);
|
|
131
133
|
} else {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
if (overwrite && entity_data && entity_data[field.mapped_entity_type]) {
|
|
135
|
+
inMemory[entityType][filterCode] = entity_data;
|
|
136
|
+
} else {
|
|
137
|
+
const relations = await this.datasource.query(
|
|
138
|
+
`SELECT target_entity_id
|
|
139
|
+
FROM frm_entity_relation_data
|
|
140
|
+
WHERE source_entity_type = ?
|
|
141
|
+
AND source_entity_id = ?
|
|
142
|
+
AND target_entity_type = ?`,
|
|
143
|
+
[parent_type, parent_id, field.mapped_entity_type],
|
|
144
|
+
);
|
|
140
145
|
|
|
141
|
-
|
|
146
|
+
const targetEntityIds = relations.map((r) => r.target_entity_id);
|
|
142
147
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
this.loggingService.log(
|
|
149
|
+
'package',
|
|
150
|
+
'fieldMapperService',
|
|
151
|
+
'targetEntityIds',
|
|
152
|
+
targetEntityIds,
|
|
153
|
+
);
|
|
149
154
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
inMemory[entityType][filterCode] =
|
|
177
|
-
filterResponse?.data?.entity_list[0];
|
|
178
|
-
} else {
|
|
179
|
-
let firstId = targetEntityIds[0];
|
|
180
|
-
if (mappedEntities && mappedEntities[entityType])
|
|
181
|
-
firstId = mappedEntities[entityType];
|
|
182
|
-
inMemory[entityType][filterCode] =
|
|
183
|
-
await super.getResolvedEntityData(
|
|
184
|
-
entityType,
|
|
185
|
-
firstId,
|
|
186
|
-
userData,
|
|
155
|
+
if (targetEntityIds.length > 0) {
|
|
156
|
+
if (filterCode && filterCode !== 'default') {
|
|
157
|
+
let filterResponse =
|
|
158
|
+
await this.filterService.applyFilterWrapper({
|
|
159
|
+
entity_type: entityType,
|
|
160
|
+
savedFilterCode: filterCode,
|
|
161
|
+
quickFilter: [
|
|
162
|
+
{
|
|
163
|
+
filter_attribute: 'id',
|
|
164
|
+
filter_operator: 'equal',
|
|
165
|
+
filter_value: targetEntityIds,
|
|
166
|
+
filter_entity_type: entityType,
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
attributeFilter: [],
|
|
170
|
+
loggedInUser: userData,
|
|
171
|
+
queryParams: {},
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
this.loggingService.log(
|
|
175
|
+
'package',
|
|
176
|
+
'fieldMapperService',
|
|
177
|
+
'filterResponse',
|
|
178
|
+
`${filterResponse}`,
|
|
187
179
|
);
|
|
180
|
+
|
|
181
|
+
inMemory[entityType][filterCode] =
|
|
182
|
+
filterResponse?.data?.entity_list[0];
|
|
183
|
+
} else {
|
|
184
|
+
let firstId = targetEntityIds[0];
|
|
185
|
+
if (mappedEntities && mappedEntities[entityType])
|
|
186
|
+
firstId = mappedEntities[entityType];
|
|
187
|
+
inMemory[entityType][filterCode] =
|
|
188
|
+
await super.getResolvedEntityData(
|
|
189
|
+
entityType,
|
|
190
|
+
firstId,
|
|
191
|
+
userData,
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
inMemory[entityType][filterCode] = null;
|
|
188
196
|
}
|
|
189
|
-
} else {
|
|
190
|
-
inMemory[entityType][filterCode] = null;
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
}
|
|
@@ -35,7 +35,9 @@ export class CommTemplateController {
|
|
|
35
35
|
|
|
36
36
|
@Post('/resolve-message')
|
|
37
37
|
@HttpCode(HttpStatus.OK)
|
|
38
|
-
async resolveMessage(@Body() payload: any
|
|
39
|
-
|
|
38
|
+
async resolveMessage(@Body() payload: any,
|
|
39
|
+
@Req() req: Request & { user: any },) {
|
|
40
|
+
const loggedInUser = req.user.userData;
|
|
41
|
+
return await this.commTemplateService.getResolvedTemplateMsg(payload, loggedInUser);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
@@ -125,7 +125,7 @@ export class CommTemplateService extends EntityServiceImpl {
|
|
|
125
125
|
return response;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
async getResolvedTemplateMsg(payload: any) {
|
|
128
|
+
async getResolvedTemplateMsg(payload: any, loggedInUser: UserData) {
|
|
129
129
|
let commTemplate = await this.commTemplateRepository.findByCodeAndLevelIdAndLevelTypeAndAppCode(
|
|
130
130
|
payload.template_code,
|
|
131
131
|
payload.level_id,
|
|
@@ -134,7 +134,7 @@ export class CommTemplateService extends EntityServiceImpl {
|
|
|
134
134
|
);
|
|
135
135
|
|
|
136
136
|
let variables;
|
|
137
|
-
if (commTemplate && !
|
|
137
|
+
if (commTemplate && !commTemplate.template_id) {
|
|
138
138
|
|
|
139
139
|
if (commTemplate.mapper_id) {
|
|
140
140
|
variables = await this.fieldMapperService.resolveData(
|
|
@@ -142,7 +142,11 @@ export class CommTemplateService extends EntityServiceImpl {
|
|
|
142
142
|
'LOOKUP',
|
|
143
143
|
payload.entity_type,
|
|
144
144
|
payload.entity_id,
|
|
145
|
-
|
|
145
|
+
loggedInUser,
|
|
146
|
+
undefined,
|
|
147
|
+
undefined,
|
|
148
|
+
payload.overwrite || false,
|
|
149
|
+
payload.entity_data || null,
|
|
146
150
|
);
|
|
147
151
|
}
|
|
148
152
|
|
|
@@ -170,7 +174,7 @@ export class CommTemplateService extends EntityServiceImpl {
|
|
|
170
174
|
};
|
|
171
175
|
}
|
|
172
176
|
} else {
|
|
173
|
-
throw new BadRequestException(
|
|
177
|
+
throw new BadRequestException('Editing is disabled for external templates');
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
}
|