rez_core 3.1.26 → 3.1.29
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/filter/controller/filter.controller.d.ts +3 -0
- package/dist/module/filter/controller/filter.controller.js +13 -0
- package/dist/module/filter/controller/filter.controller.js.map +1 -1
- package/dist/module/filter/repository/saved-filter.repository.d.ts +5 -2
- package/dist/module/filter/repository/saved-filter.repository.js +19 -2
- package/dist/module/filter/repository/saved-filter.repository.js.map +1 -1
- package/dist/module/filter/service/saved-filter.service.d.ts +1 -0
- package/dist/module/filter/service/saved-filter.service.js +3 -0
- package/dist/module/filter/service/saved-filter.service.js.map +1 -1
- package/dist/module/workflow/controller/action.controller.d.ts +1 -0
- package/dist/module/workflow/entity/action-data.entity.d.ts +1 -0
- package/dist/module/workflow/entity/action-data.entity.js +4 -0
- package/dist/module/workflow/entity/action-data.entity.js.map +1 -1
- package/dist/module/workflow/repository/action.repository.d.ts +1 -0
- package/dist/module/workflow/repository/action.repository.js +2 -0
- package/dist/module/workflow/repository/action.repository.js.map +1 -1
- package/dist/module/workflow/service/action.service.d.ts +1 -0
- package/dist/module/workflow-automation/service/workflow-automation.service.d.ts +1 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.js +8 -34
- package/dist/module/workflow-automation/service/workflow-automation.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/filter/controller/filter.controller.ts +10 -0
- package/src/module/filter/repository/saved-filter.repository.ts +31 -2
- package/src/module/filter/service/saved-filter.service.ts +11 -3
- package/src/module/workflow/entity/action-data.entity.ts +3 -0
- package/src/module/workflow/repository/action.repository.ts +2 -0
- package/src/module/workflow-automation/service/workflow-automation.service.ts +47 -60
- package/.vscode/extensions.json +0 -5
package/package.json
CHANGED
|
@@ -71,4 +71,14 @@ export class FilterController {
|
|
|
71
71
|
async getFilterById(@Param('id') id: string) {
|
|
72
72
|
return this.savedFilterService.getFilterById(Number(id));
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
@Get('getsavedfilterbycode/:code')
|
|
76
|
+
@UseGuards(JwtAuthGuard)
|
|
77
|
+
async getSavedFilterByCode(
|
|
78
|
+
@Param('code') code: string,
|
|
79
|
+
@Req() req: Request & { user: any },
|
|
80
|
+
) {
|
|
81
|
+
const loggedInUser = req.user.userData;
|
|
82
|
+
return this.savedFilterService.getSavedFilterByCode(code, loggedInUser);
|
|
83
|
+
}
|
|
74
84
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
1
|
+
import { Inject, Injectable } from '@nestjs/common';
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import { Repository, Not } from 'typeorm';
|
|
3
|
+
import { Repository, Not, DataSource } from 'typeorm';
|
|
4
4
|
import { SavedFilterMaster } from '../entity/saved-filter-master.entity';
|
|
5
5
|
import { SavedFilterDetail } from '../entity/saved-filter-detail.entity';
|
|
6
|
+
import { SavedFilterService } from '../service/saved-filter.service';
|
|
7
|
+
import { ENTITYTYPE_SAVEDFILTERMASTER } from 'src/constant/global.constant';
|
|
8
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
6
9
|
|
|
7
10
|
@Injectable()
|
|
8
11
|
export class SavedFilterRepositoryService {
|
|
@@ -11,6 +14,7 @@ export class SavedFilterRepositoryService {
|
|
|
11
14
|
private readonly savedFilterMasterRepo: Repository<SavedFilterMaster>,
|
|
12
15
|
@InjectRepository(SavedFilterDetail)
|
|
13
16
|
private readonly savedFilterDetailRepo: Repository<SavedFilterDetail>,
|
|
17
|
+
private readonly dataSource: DataSource,
|
|
14
18
|
) {}
|
|
15
19
|
|
|
16
20
|
async isFilterNameExists({
|
|
@@ -121,4 +125,29 @@ export class SavedFilterRepositoryService {
|
|
|
121
125
|
: detail.filter_value,
|
|
122
126
|
}));
|
|
123
127
|
}
|
|
128
|
+
|
|
129
|
+
async getSavedFilterByCode(
|
|
130
|
+
code: string,
|
|
131
|
+
loggedInUser: UserData,
|
|
132
|
+
): Promise<any> {
|
|
133
|
+
const [filterMaster] = await this.dataSource.query(
|
|
134
|
+
`SELECT id, name, code
|
|
135
|
+
FROM cr_saved_filter_master
|
|
136
|
+
WHERE code = ? AND organization_id = ?
|
|
137
|
+
LIMIT 1
|
|
138
|
+
`,
|
|
139
|
+
[code, loggedInUser.organization_id],
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
if (!filterMaster) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const filterDetails = await this.getDetailsByCode(filterMaster.code);
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
...filterMaster,
|
|
150
|
+
filterDetails,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
124
153
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BadRequestException,
|
|
3
|
+
forwardRef,
|
|
4
|
+
Inject,
|
|
5
|
+
Injectable,
|
|
6
|
+
} from '@nestjs/common';
|
|
2
7
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
3
8
|
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
4
9
|
import { UserData } from '../../user/entity/user.entity';
|
|
@@ -9,8 +14,7 @@ import { SavedFilterRepositoryService } from '../repository/saved-filter.reposit
|
|
|
9
14
|
|
|
10
15
|
@Injectable()
|
|
11
16
|
export class SavedFilterService extends EntityServiceImpl {
|
|
12
|
-
constructor(private readonly savedFilterRepo: SavedFilterRepositoryService
|
|
13
|
-
) {
|
|
17
|
+
constructor(private readonly savedFilterRepo: SavedFilterRepositoryService) {
|
|
14
18
|
super();
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -159,4 +163,8 @@ export class SavedFilterService extends EntityServiceImpl {
|
|
|
159
163
|
async getFilterById(id: number) {
|
|
160
164
|
return await this.savedFilterRepo.getFilterById(id);
|
|
161
165
|
}
|
|
166
|
+
|
|
167
|
+
async getSavedFilterByCode(code: string, loggedInUser: UserData) {
|
|
168
|
+
return await this.savedFilterRepo.getSavedFilterByCode(code, loggedInUser);
|
|
169
|
+
}
|
|
162
170
|
}
|
|
@@ -199,6 +199,7 @@ export class ActionRepository {
|
|
|
199
199
|
'a.reason_code AS action_reason_code',
|
|
200
200
|
'a.default_reason_code AS default_reason_code',
|
|
201
201
|
'a.default_value AS default_value',
|
|
202
|
+
'a.mode AS mode',
|
|
202
203
|
'a.action_category AS action_category_id',
|
|
203
204
|
'ac.reason_code AS category_reason_code',
|
|
204
205
|
'ac.modalName AS modalName',
|
|
@@ -254,6 +255,7 @@ export class ActionRepository {
|
|
|
254
255
|
label: row.action_name,
|
|
255
256
|
modalName: row.modalName,
|
|
256
257
|
logo: row.logo,
|
|
258
|
+
mode: row.mode,
|
|
257
259
|
name: row.action_category_name,
|
|
258
260
|
reason_code,
|
|
259
261
|
default_reason_code: row.default_reason_code,
|
|
@@ -71,7 +71,7 @@ export class WorkflowAutomationService extends EntityServiceImpl {
|
|
|
71
71
|
`Updating WorkflowAutomation with data: ${JSON.stringify(entityData)}`,
|
|
72
72
|
);
|
|
73
73
|
|
|
74
|
-
const { event,
|
|
74
|
+
const { event, filter, action, ...workflowData } = entityData;
|
|
75
75
|
|
|
76
76
|
// 1. Update core workflow columns first
|
|
77
77
|
this.logger.log(`Updating core workflow fields for workflow...`);
|
|
@@ -126,47 +126,49 @@ export class WorkflowAutomationService extends EntityServiceImpl {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// 3. CRITERIA FILTER
|
|
129
|
-
if (
|
|
129
|
+
if (filter?.filter_code) {
|
|
130
130
|
this.logger.log(`Processing CRITERIA filter for workflow ${workflow.id}`);
|
|
131
131
|
|
|
132
|
-
const criteriaFilterMaster = {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
if (workflow.criteria_filter_code) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
} else {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
132
|
+
// const criteriaFilterMaster = {
|
|
133
|
+
// entity_type: 'SFM',
|
|
134
|
+
// name: `Criteria_Filter_${workflow.id}`,
|
|
135
|
+
// filterDetails: criteria?.criteriaFilterJson ?? [],
|
|
136
|
+
// filter_scope: 'RULE',
|
|
137
|
+
// organization_id: loggedInUser.organization_id,
|
|
138
|
+
// enterprise_id: loggedInUser.enterprise_id,
|
|
139
|
+
// };
|
|
140
|
+
|
|
141
|
+
// if (workflow.criteria_filter_code) {
|
|
142
|
+
// this.logger.debug(
|
|
143
|
+
// `Existing criteria filter found: ${workflow.criteria_filter_code}`,
|
|
144
|
+
// );
|
|
145
|
+
// const existing = await this.savedFilterService.getEntityDataByCode(
|
|
146
|
+
// ENTITYTYPE_SAVEDFILTERMASTER,
|
|
147
|
+
// workflow.criteria_filter_code,
|
|
148
|
+
// loggedInUser,
|
|
149
|
+
// );
|
|
150
|
+
|
|
151
|
+
// if (existing) {
|
|
152
|
+
// criteriaFilterMaster['id'] = existing.id;
|
|
153
|
+
// const updatedCriteria = await this.savedFilterService.updateEntity(
|
|
154
|
+
// criteriaFilterMaster as any,
|
|
155
|
+
// loggedInUser,
|
|
156
|
+
// );
|
|
157
|
+
// workflow.criteria_filter_code = updatedCriteria.code;
|
|
158
|
+
// this.logger.log(
|
|
159
|
+
// `Updated existing criteria filter: ${updatedCriteria.code}`,
|
|
160
|
+
// );
|
|
161
|
+
// }
|
|
162
|
+
// } else {
|
|
163
|
+
// const savedCriteria = await this.savedFilterService.createEntity(
|
|
164
|
+
// criteriaFilterMaster,
|
|
165
|
+
// loggedInUser,
|
|
166
|
+
// );
|
|
167
|
+
// workflow.criteria_filter_code = savedCriteria.code;
|
|
168
|
+
// this.logger.log(`Created new criteria filter: ${savedCriteria.code}`);
|
|
169
|
+
// }
|
|
170
|
+
|
|
171
|
+
workflow.criteria_filter_code = entityData.filter.filter_code;
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
// 4. ACTIONS
|
|
@@ -282,26 +284,11 @@ export class WorkflowAutomationService extends EntityServiceImpl {
|
|
|
282
284
|
}
|
|
283
285
|
|
|
284
286
|
// 3. CRITERIA FILTER
|
|
285
|
-
let
|
|
287
|
+
let filter: any = null;
|
|
286
288
|
if (workflowAutomation.criteria_filter_code) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
workflowAutomation.criteria_filter_code,
|
|
291
|
-
loggedInUser,
|
|
292
|
-
);
|
|
293
|
-
|
|
294
|
-
if (criteriaFilterMaster) {
|
|
295
|
-
// 🔑 fetch filter details using mapped_filter_code
|
|
296
|
-
const criteriaFilterDetails =
|
|
297
|
-
await this.savedFilterService.getDetailsByCode(
|
|
298
|
-
criteriaFilterMaster.code,
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
criteria = {
|
|
302
|
-
criteriaFilterJson: criteriaFilterDetails ?? [],
|
|
303
|
-
};
|
|
304
|
-
}
|
|
289
|
+
filter = {
|
|
290
|
+
filter_code: workflowAutomation.criteria_filter_code,
|
|
291
|
+
};
|
|
305
292
|
}
|
|
306
293
|
|
|
307
294
|
// 4. ACTIONS
|
|
@@ -321,7 +308,7 @@ export class WorkflowAutomationService extends EntityServiceImpl {
|
|
|
321
308
|
const response = {
|
|
322
309
|
...workflowAutomation,
|
|
323
310
|
event,
|
|
324
|
-
|
|
311
|
+
filter,
|
|
325
312
|
action,
|
|
326
313
|
};
|
|
327
314
|
|