rez_core 2.2.86 → 2.2.88
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/.vscode/extensions.json +5 -0
- package/dist/module/meta/controller/meta.controller.d.ts +6 -1
- package/dist/module/meta/controller/meta.controller.js +19 -2
- package/dist/module/meta/controller/meta.controller.js.map +1 -1
- package/dist/module/meta/service/populate-meta.service.js +5 -1
- package/dist/module/meta/service/populate-meta.service.js.map +1 -1
- package/dist/module/workflow/controller/action.controller.d.ts +1 -1
- package/dist/module/workflow/controller/action.controller.js +4 -3
- package/dist/module/workflow/controller/action.controller.js.map +1 -1
- package/dist/module/workflow/repository/action-data.repository.d.ts +1 -1
- package/dist/module/workflow/repository/action-data.repository.js +7 -1
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/module/workflow/repository/task.repository.js +1 -0
- package/dist/module/workflow/repository/task.repository.js.map +1 -1
- package/dist/module/workflow/service/action-data.service.d.ts +1 -1
- package/dist/module/workflow/service/action-data.service.js +2 -2
- package/dist/module/workflow/service/action-data.service.js.map +1 -1
- package/dist/module/workflow/service/action.service.js +10 -14
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/populate-workflow.service.js +3 -0
- package/dist/module/workflow/service/populate-workflow.service.js.map +1 -1
- package/dist/module/workflow/service/task.service.js +4 -0
- package/dist/module/workflow/service/task.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/meta/controller/meta.controller.ts +17 -1
- package/src/module/meta/service/populate-meta.service.ts +5 -1
- package/src/module/workflow/controller/action.controller.ts +4 -2
- package/src/module/workflow/repository/action-data.repository.ts +10 -3
- package/src/module/workflow/repository/task.repository.ts +1 -0
- package/src/module/workflow/service/action-data.service.ts +6 -4
- package/src/module/workflow/service/action.service.ts +13 -15
- package/src/module/workflow/service/populate-workflow.service.ts +11 -0
- package/src/module/workflow/service/task.service.ts +5 -0
package/package.json
CHANGED
|
@@ -10,11 +10,15 @@ import {
|
|
|
10
10
|
import { EntityTableService } from '../service/entity-table.service';
|
|
11
11
|
import { Response } from 'express';
|
|
12
12
|
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
13
|
+
import { PopulateMetaService } from '../service/populate-meta.service';
|
|
13
14
|
|
|
14
15
|
@Controller('meta')
|
|
15
16
|
@UseGuards(JwtAuthGuard)
|
|
16
17
|
export class MetaController {
|
|
17
|
-
constructor(
|
|
18
|
+
constructor(
|
|
19
|
+
private readonly entityTableService: EntityTableService,
|
|
20
|
+
private readonly populateMetaService: PopulateMetaService,
|
|
21
|
+
) {}
|
|
18
22
|
|
|
19
23
|
@Post('get-table-data')
|
|
20
24
|
async getTableMetaData(
|
|
@@ -36,4 +40,16 @@ export class MetaController {
|
|
|
36
40
|
message: 'Data fetch successfully!',
|
|
37
41
|
});
|
|
38
42
|
}
|
|
43
|
+
|
|
44
|
+
@Post('populate')
|
|
45
|
+
async populateMetaData(
|
|
46
|
+
@Query('organization_id') organizationId: number,
|
|
47
|
+
@Res() response: Response,
|
|
48
|
+
@Req() req: Request & { user: any },
|
|
49
|
+
) {
|
|
50
|
+
const loggedInUser = req.user.userData;
|
|
51
|
+
const result =
|
|
52
|
+
await this.populateMetaService.populateMetaData(organizationId);
|
|
53
|
+
return response.status(HttpStatus.OK).json(result);
|
|
54
|
+
}
|
|
39
55
|
}
|
|
@@ -52,7 +52,11 @@ export class PopulateMetaService {
|
|
|
52
52
|
// }
|
|
53
53
|
|
|
54
54
|
async populateMetaData(organization_id: number) {
|
|
55
|
-
const metadataTables = [
|
|
55
|
+
const metadataTables = [
|
|
56
|
+
'cr_entity_master',
|
|
57
|
+
'cr_attribute_master',
|
|
58
|
+
'cr_view_master',
|
|
59
|
+
];
|
|
56
60
|
const entityTypeToNewIdMap = new Map<string, number>();
|
|
57
61
|
|
|
58
62
|
// Step 1: Insert basic metadata tables
|
|
@@ -80,13 +80,15 @@ export class ActionController {
|
|
|
80
80
|
@Body('stage_id') stage_id: number,
|
|
81
81
|
@Body('mapped_entity_id') mapped_entity_id: number,
|
|
82
82
|
@Body('mapped_entity_type') mapped_entity_type: string,
|
|
83
|
+
@Body('action_id') action_id: number,
|
|
83
84
|
) {
|
|
84
85
|
const loggedInUser = req.user.userData;
|
|
85
86
|
const result = this.actionDataService.resubmitAction(
|
|
86
87
|
loggedInUser,
|
|
87
|
-
stage_id,
|
|
88
|
-
mapped_entity_id,
|
|
89
88
|
mapped_entity_type,
|
|
89
|
+
mapped_entity_id,
|
|
90
|
+
stage_id,
|
|
91
|
+
action_id,
|
|
90
92
|
);
|
|
91
93
|
return result;
|
|
92
94
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
1
|
+
import { BadRequestException, Injectable } from '@nestjs/common';
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
3
|
import { ActionDataEntity } from '../entity/action-data.entity';
|
|
4
4
|
import { DataSource, LessThan, Repository } from 'typeorm';
|
|
@@ -45,6 +45,8 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
45
45
|
user_id: loggedInUser.id,
|
|
46
46
|
action_id: act.id,
|
|
47
47
|
sequence: act.sequence,
|
|
48
|
+
name: act.name,
|
|
49
|
+
organization_id: loggedInUser.organization_id,
|
|
48
50
|
mapped_entity_id,
|
|
49
51
|
mapped_entity_type,
|
|
50
52
|
is_current: isFirst ? 'Y' : null,
|
|
@@ -124,9 +126,10 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
124
126
|
|
|
125
127
|
async resubmitAction(
|
|
126
128
|
organization_id: number,
|
|
127
|
-
stage_id: number,
|
|
128
|
-
mapped_entity_id: number,
|
|
129
129
|
mapped_entity_type: string,
|
|
130
|
+
mapped_entity_id: number,
|
|
131
|
+
stage_id: number,
|
|
132
|
+
action_id: number,
|
|
130
133
|
) {
|
|
131
134
|
// Get the current active action
|
|
132
135
|
const currentAction = await this.actionDataRepo.findOne({
|
|
@@ -135,6 +138,7 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
135
138
|
stage_id,
|
|
136
139
|
mapped_entity_id,
|
|
137
140
|
mapped_entity_type,
|
|
141
|
+
action_id,
|
|
138
142
|
is_current: 'Y',
|
|
139
143
|
},
|
|
140
144
|
});
|
|
@@ -165,6 +169,7 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
165
169
|
currentAction.is_current = null as any;
|
|
166
170
|
currentAction.modified_date = new Date();
|
|
167
171
|
currentAction.modified_by = organization_id;
|
|
172
|
+
currentAction.start_time = null as any;
|
|
168
173
|
currentAction.resubmit_count = (currentAction.resubmit_count ?? 0) + 1;
|
|
169
174
|
|
|
170
175
|
await this.actionDataRepo.update(currentAction.id, currentAction);
|
|
@@ -173,6 +178,8 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
173
178
|
previousAction.is_current = 'Y';
|
|
174
179
|
previousAction.modified_date = new Date();
|
|
175
180
|
previousAction.modified_by = organization_id;
|
|
181
|
+
previousAction.end_time = null as any; // Reset end time
|
|
182
|
+
previousAction.is_done = true;
|
|
176
183
|
await this.actionDataRepo.update(previousAction.id, previousAction);
|
|
177
184
|
|
|
178
185
|
// reverse the status of tasks for the previous action
|
|
@@ -54,6 +54,7 @@ export class TaskRepository {
|
|
|
54
54
|
stage_id: act.stage_id,
|
|
55
55
|
user_id: loggedInUser.id,
|
|
56
56
|
action_id: act.id,
|
|
57
|
+
organization_id: loggedInUser.organization_id,
|
|
57
58
|
name: act.name,
|
|
58
59
|
sequence: act.sequence,
|
|
59
60
|
is_mandatory: is_mandatory[0]?.code === 'mandatory' ? true : false,
|
|
@@ -45,16 +45,18 @@ export class ActionDataService extends EntityServiceImpl {
|
|
|
45
45
|
|
|
46
46
|
async resubmitAction(
|
|
47
47
|
loggedInUser: UserData,
|
|
48
|
-
stage_id: number,
|
|
49
|
-
mapped_entity_id: number,
|
|
50
48
|
mapped_entity_type: string,
|
|
49
|
+
mapped_entity_id: number,
|
|
50
|
+
stage_id: number,
|
|
51
|
+
action_id: number,
|
|
51
52
|
) {
|
|
52
53
|
const { organization_id } = loggedInUser;
|
|
53
54
|
return this.actionDataRepo.resubmitAction(
|
|
54
55
|
organization_id,
|
|
55
|
-
stage_id,
|
|
56
|
-
mapped_entity_id,
|
|
57
56
|
mapped_entity_type,
|
|
57
|
+
mapped_entity_id,
|
|
58
|
+
stage_id,
|
|
59
|
+
action_id,
|
|
58
60
|
);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -97,23 +97,21 @@ export class ActionService extends EntityServiceImpl {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
stg_act_mapping_id: stageActionMappingData.id,
|
|
105
|
-
form_id: formId,
|
|
106
|
-
type: 'form',
|
|
107
|
-
entity_type: 'ARMS',
|
|
108
|
-
form_entity_type: 'LEAD',
|
|
109
|
-
} as any;
|
|
100
|
+
await this.dataSource.query(
|
|
101
|
+
`DELETE FROM cr_wf_action_resources_mapping WHERE stg_act_mapping_id = ? AND type = 'form'`,
|
|
102
|
+
[stageActionMappingData.id],
|
|
103
|
+
);
|
|
110
104
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
if (actionData.form) {
|
|
106
|
+
const resourceMapping = {
|
|
107
|
+
stg_act_mapping_id: stageActionMappingData.id,
|
|
108
|
+
organization_id: entityData.organization_id,
|
|
109
|
+
form_id: actionData.form,
|
|
110
|
+
type: 'form',
|
|
111
|
+
entity_type: 'ARMS',
|
|
112
|
+
} as any;
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
}
|
|
114
|
+
await super.createEntity(resourceMapping, loggedInUser);
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
return actionData;
|
|
@@ -272,6 +272,16 @@ export class PopulateWorkflowService extends EntityServiceImpl {
|
|
|
272
272
|
|
|
273
273
|
console.log(`Matched new mandatory item:`, matchedNewMandatory);
|
|
274
274
|
|
|
275
|
+
const formActionCategory = await this.dataSource.query(
|
|
276
|
+
`SELECT id FROM cr_wf_action_category WHERE id = ? and is_form = 1`,
|
|
277
|
+
[row.action_category],
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
//get view master form
|
|
281
|
+
const formViewMaster = await this.dataSource.query(
|
|
282
|
+
`SELECT id FROM cr_view_master WHERE code = "LEAD_FORM"`,
|
|
283
|
+
);
|
|
284
|
+
|
|
275
285
|
// Step 4: Use the matched new item's id (if found)
|
|
276
286
|
await this.actionService.createEntity(
|
|
277
287
|
{
|
|
@@ -282,6 +292,7 @@ export class PopulateWorkflowService extends EntityServiceImpl {
|
|
|
282
292
|
action_requirement: matchedNewMandatory?.id ?? null,
|
|
283
293
|
level_id: organization_id,
|
|
284
294
|
entity_type: 'ACTN',
|
|
295
|
+
form: formActionCategory.length > 0 ? formViewMaster[0]?.id : null,
|
|
285
296
|
},
|
|
286
297
|
loggedInUser,
|
|
287
298
|
);
|
|
@@ -252,6 +252,11 @@ export class TaskService extends EntityServiceImpl {
|
|
|
252
252
|
task.task_status = task.status
|
|
253
253
|
? statusMap.get(String(task.status)) || null
|
|
254
254
|
: null;
|
|
255
|
+
|
|
256
|
+
task.action_name =
|
|
257
|
+
task.action_id === '0' || task.action_id === 0
|
|
258
|
+
? 'Generic'
|
|
259
|
+
: task.action_name;
|
|
255
260
|
}
|
|
256
261
|
|
|
257
262
|
// Normalize is_mandatory to '0'/'1' as string
|