rez_core 2.1.139 → 2.1.141
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/workflow/controller/comm-template.controller.d.ts +11 -0
- package/dist/module/workflow/controller/comm-template.controller.js +44 -0
- package/dist/module/workflow/controller/comm-template.controller.js.map +1 -0
- package/dist/module/workflow/controller/stage-group.controller.d.ts +8 -2
- package/dist/module/workflow/controller/stage-group.controller.js +17 -5
- package/dist/module/workflow/controller/stage-group.controller.js.map +1 -1
- package/dist/module/workflow/controller/stage.controller.d.ts +13 -0
- package/dist/module/workflow/controller/stage.controller.js +56 -0
- package/dist/module/workflow/controller/stage.controller.js.map +1 -0
- package/dist/module/workflow/controller/workflow.controller.d.ts +11 -1
- package/dist/module/workflow/controller/workflow.controller.js +13 -0
- package/dist/module/workflow/controller/workflow.controller.js.map +1 -1
- package/dist/module/workflow/entity/action.entity.d.ts +4 -1
- package/dist/module/workflow/entity/action.entity.js +20 -8
- package/dist/module/workflow/entity/action.entity.js.map +1 -1
- package/dist/module/workflow/entity/stage-group.entity.d.ts +1 -1
- package/dist/module/workflow/entity/stage-group.entity.js +1 -1
- package/dist/module/workflow/entity/stage-group.entity.js.map +1 -1
- package/dist/module/workflow/entity/stage.entity.d.ts +1 -2
- package/dist/module/workflow/entity/stage.entity.js +1 -5
- package/dist/module/workflow/entity/stage.entity.js.map +1 -1
- package/dist/module/workflow/repository/comm-template.repository.d.ts +7 -0
- package/dist/module/workflow/repository/comm-template.repository.js +39 -0
- package/dist/module/workflow/repository/comm-template.repository.js.map +1 -0
- package/dist/module/workflow/repository/stage-group.repository.d.ts +7 -0
- package/dist/module/workflow/repository/stage-group.repository.js +50 -0
- package/dist/module/workflow/repository/stage-group.repository.js.map +1 -0
- package/dist/module/workflow/repository/stage.repository.d.ts +7 -0
- package/dist/module/workflow/repository/stage.repository.js +50 -0
- package/dist/module/workflow/repository/stage.repository.js.map +1 -0
- package/dist/module/workflow/service/action.service.d.ts +3 -0
- package/dist/module/workflow/service/action.service.js +46 -7
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/comm-template.service.d.ts +8 -2
- package/dist/module/workflow/service/comm-template.service.js +18 -3
- package/dist/module/workflow/service/comm-template.service.js.map +1 -1
- package/dist/module/workflow/service/stage-group.service.d.ts +11 -0
- package/dist/module/workflow/service/stage-group.service.js +36 -1
- package/dist/module/workflow/service/stage-group.service.js.map +1 -1
- package/dist/module/workflow/service/stage.service.d.ts +14 -4
- package/dist/module/workflow/service/stage.service.js +57 -13
- package/dist/module/workflow/service/stage.service.js.map +1 -1
- package/dist/module/workflow/service/workflow.service.d.ts +15 -1
- package/dist/module/workflow/service/workflow.service.js +43 -2
- package/dist/module/workflow/service/workflow.service.js.map +1 -1
- package/dist/module/workflow/workflow.module.js +17 -2
- package/dist/module/workflow/workflow.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/workflow/controller/comm-template.controller.ts +31 -0
- package/src/module/workflow/controller/stage-group.controller.ts +27 -4
- package/src/module/workflow/controller/stage.controller.ts +50 -0
- package/src/module/workflow/controller/workflow.controller.ts +7 -1
- package/src/module/workflow/entity/action.entity.ts +10 -1
- package/src/module/workflow/entity/stage-group.entity.ts +1 -1
- package/src/module/workflow/entity/stage.entity.ts +1 -4
- package/src/module/workflow/repository/comm-template.repository.ts +22 -0
- package/src/module/workflow/repository/stage-group.repository.ts +46 -0
- package/src/module/workflow/repository/stage.repository.ts +47 -0
- package/src/module/workflow/service/action.service.ts +106 -14
- package/src/module/workflow/service/comm-template.service.ts +21 -2
- package/src/module/workflow/service/stage-group.service.ts +66 -2
- package/src/module/workflow/service/stage.service.ts +104 -28
- package/src/module/workflow/service/workflow.service.ts +70 -0
- package/src/module/workflow/workflow.module.ts +17 -2
|
@@ -1,47 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ActionService } from './action.service';
|
|
2
|
+
import {
|
|
3
|
+
BadRequestException,
|
|
4
|
+
Inject,
|
|
5
|
+
Injectable,
|
|
6
|
+
NotFoundException,
|
|
7
|
+
} from '@nestjs/common';
|
|
3
8
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
9
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
4
10
|
import { UserData } from 'src/module/user/entity/user.entity';
|
|
5
|
-
import {
|
|
11
|
+
import { StageRepository } from '../repository/stage.repository';
|
|
12
|
+
import { DataSource } from 'typeorm';
|
|
13
|
+
import { StageGroupRepository } from '../repository/stage-group.repository';
|
|
6
14
|
|
|
7
15
|
@Injectable()
|
|
8
16
|
export class StageService extends EntityServiceImpl {
|
|
9
|
-
constructor(
|
|
17
|
+
constructor(
|
|
18
|
+
private readonly stageRepository: StageRepository,
|
|
19
|
+
private readonly stageGroupRepository: StageGroupRepository,
|
|
20
|
+
private readonly dataSource: DataSource,
|
|
21
|
+
@Inject('ActionService')
|
|
22
|
+
private readonly actionService: ActionService,
|
|
23
|
+
) {
|
|
10
24
|
super();
|
|
11
25
|
}
|
|
26
|
+
async getAllStage(
|
|
27
|
+
stage_group_id: number,
|
|
28
|
+
level_id: string,
|
|
29
|
+
level_type: string,
|
|
30
|
+
) {
|
|
31
|
+
return await this.stageRepository.getAllStage(
|
|
32
|
+
stage_group_id,
|
|
33
|
+
level_id,
|
|
34
|
+
level_type,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
12
37
|
|
|
13
|
-
async
|
|
38
|
+
async updateEntity(
|
|
14
39
|
entityData: BaseEntity,
|
|
15
|
-
loggedInUser: UserData
|
|
16
|
-
|
|
17
|
-
|
|
40
|
+
loggedInUser: UserData,
|
|
41
|
+
): Promise<any> {
|
|
42
|
+
return await super.updateEntity(entityData, loggedInUser);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async getEntityData(
|
|
46
|
+
entityType: string,
|
|
47
|
+
id: number,
|
|
48
|
+
loggedInUser?: UserData,
|
|
49
|
+
): Promise<BaseEntity | null> {
|
|
50
|
+
return await super.getEntityData(entityType, id, loggedInUser);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async deleteEntity(
|
|
54
|
+
entityType: string,
|
|
55
|
+
id: number,
|
|
56
|
+
loggedInUser: UserData,
|
|
18
57
|
): Promise<any> {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
58
|
+
const getAllStageAction = await this.dataSource.query(
|
|
59
|
+
`SELECT action_id FROM cr_wf_stage_action_mapping WHERE stage_id = ? AND entity_type = 'STGM'`,
|
|
60
|
+
[id],
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (getAllStageAction.length > 0) {
|
|
64
|
+
for (const action of getAllStageAction) {
|
|
65
|
+
await this.actionService.deleteEntity(
|
|
66
|
+
'ACTN',
|
|
67
|
+
action.action_id,
|
|
68
|
+
loggedInUser,
|
|
69
|
+
);
|
|
31
70
|
}
|
|
32
71
|
}
|
|
33
72
|
|
|
34
|
-
|
|
35
|
-
|
|
73
|
+
const deleteStage = await super.deleteEntity(entityType, id, loggedInUser);
|
|
74
|
+
|
|
75
|
+
return deleteStage;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async getStagesWithGroupName(
|
|
79
|
+
workflow_id: number,
|
|
80
|
+
level_id: string,
|
|
81
|
+
level_type: string,
|
|
82
|
+
) {
|
|
83
|
+
if (!workflow_id) {
|
|
84
|
+
throw new BadRequestException('workflow_id is required');
|
|
36
85
|
}
|
|
37
86
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
appcode,
|
|
87
|
+
const stageGroups = await this.stageGroupRepository.getAllStageGroup(
|
|
88
|
+
workflow_id,
|
|
89
|
+
level_id,
|
|
90
|
+
level_type,
|
|
43
91
|
);
|
|
44
92
|
|
|
45
|
-
|
|
93
|
+
const stageGroupIds = stageGroups.map((group) => group.id);
|
|
94
|
+
const groupNameMap = new Map<number, string>(
|
|
95
|
+
stageGroups.map((group) => [Number(group.id), group.name]),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// Get all stages for all stageGroups
|
|
99
|
+
const allStages: any = [];
|
|
100
|
+
for (const groupId of stageGroupIds) {
|
|
101
|
+
try {
|
|
102
|
+
const stages = await this.stageRepository.getAllStage(
|
|
103
|
+
groupId,
|
|
104
|
+
level_id,
|
|
105
|
+
level_type,
|
|
106
|
+
);
|
|
107
|
+
allStages.push(...stages);
|
|
108
|
+
} catch (err) {
|
|
109
|
+
if (err instanceof NotFoundException) {
|
|
110
|
+
console.warn(`No stages for group ID ${groupId}`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
throw err;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const result = allStages.map((stage) => ({
|
|
118
|
+
stage_id: stage.id,
|
|
119
|
+
full_name: `${groupNameMap.get(stage.stage_group_id)} - ${stage.name}`,
|
|
120
|
+
}));
|
|
121
|
+
return result;
|
|
46
122
|
}
|
|
47
123
|
}
|
|
@@ -8,6 +8,9 @@ import { ListMasterService } from 'src/module/listmaster/service/list-master.ser
|
|
|
8
8
|
import { STATUS_INACTIVE, WORKFLOW } from 'src/constant/global.constant';
|
|
9
9
|
import { Workflow } from '../entity/workflow.entity';
|
|
10
10
|
|
|
11
|
+
import { StageGroupRepository } from '../repository/stage-group.repository';
|
|
12
|
+
import { StageGroupService } from './stage-group.service';
|
|
13
|
+
|
|
11
14
|
@Injectable()
|
|
12
15
|
export class WorkflowService extends EntityServiceImpl {
|
|
13
16
|
constructor(
|
|
@@ -15,6 +18,9 @@ export class WorkflowService extends EntityServiceImpl {
|
|
|
15
18
|
private readonly workflowRepository: WorkflowRepository,
|
|
16
19
|
@Inject('ListMasterService')
|
|
17
20
|
private readonly listMasterService: ListMasterService,
|
|
21
|
+
@Inject('StageGroupService')
|
|
22
|
+
private readonly stateGroupService: StageGroupService,
|
|
23
|
+
private readonly stageGroupRepository: StageGroupRepository,
|
|
18
24
|
) {
|
|
19
25
|
super();
|
|
20
26
|
}
|
|
@@ -94,4 +100,68 @@ export class WorkflowService extends EntityServiceImpl {
|
|
|
94
100
|
async deleteWorkflowById(id: number) {
|
|
95
101
|
return this.workflowRepository.deleteWorkflowById(id);
|
|
96
102
|
}
|
|
103
|
+
|
|
104
|
+
async deleteEntity(
|
|
105
|
+
entityType: string,
|
|
106
|
+
id: number,
|
|
107
|
+
loggedInUser: UserData,
|
|
108
|
+
): Promise<any> {
|
|
109
|
+
const getAllStage = await this.stageGroupRepository.getAllStageGroup(
|
|
110
|
+
id,
|
|
111
|
+
loggedInUser.level_id,
|
|
112
|
+
loggedInUser.level_type,
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
if (getAllStage.length > 0) {
|
|
116
|
+
for (const stage of getAllStage) {
|
|
117
|
+
await this.stateGroupService.deleteEntity(
|
|
118
|
+
'STGP',
|
|
119
|
+
stage.id,
|
|
120
|
+
loggedInUser,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const deleteWorkflow = await super.deleteEntity(
|
|
126
|
+
entityType,
|
|
127
|
+
id,
|
|
128
|
+
loggedInUser,
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
return deleteWorkflow;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async updateSequence(body: any[], loggedInUser: any) {
|
|
135
|
+
if (!Array.isArray(body) || body.length === 0) {
|
|
136
|
+
throw new BadRequestException(
|
|
137
|
+
'Invalid input. Expected a non-empty array.',
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const results: {
|
|
142
|
+
id: any;
|
|
143
|
+
success: boolean;
|
|
144
|
+
result?: any;
|
|
145
|
+
error?: string;
|
|
146
|
+
}[] = [];
|
|
147
|
+
|
|
148
|
+
for (const item of body) {
|
|
149
|
+
if (!item.id || item.sequence === undefined) {
|
|
150
|
+
results.push({
|
|
151
|
+
id: item.id || null,
|
|
152
|
+
success: false,
|
|
153
|
+
error: 'Missing id or sequence',
|
|
154
|
+
});
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
const result = await super.updateEntity(item, loggedInUser);
|
|
160
|
+
results.push({ id: item.id, success: true, result });
|
|
161
|
+
} catch (err) {
|
|
162
|
+
results.push({ id: item.id, success: false, error: err.message });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return { updated: results.filter((r) => r.success).length, results };
|
|
166
|
+
}
|
|
97
167
|
}
|
|
@@ -16,7 +16,6 @@ import { StageService } from './service/stage.service';
|
|
|
16
16
|
import { StageGroupService } from './service/stage-group.service';
|
|
17
17
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
18
18
|
import { EntityModule } from '../meta/entity.module';
|
|
19
|
-
import { Action } from './entity/action.entity';
|
|
20
19
|
import { WorkflowListMasterService } from './service/workflow-list-master.service';
|
|
21
20
|
import { WorkflowListMasterController } from './controller/workflow-list-master.controller';
|
|
22
21
|
import { ActionTemplateMappingController } from './controller/action-template-mapping.controller';
|
|
@@ -24,12 +23,19 @@ import { WorkflowController } from './controller/workflow.controller';
|
|
|
24
23
|
import { WorkflowRepository } from './repository/workflow.repository';
|
|
25
24
|
import { ListMasterService } from '../listmaster/service/list-master.service';
|
|
26
25
|
import { ListMasterModule } from '../listmaster/listmaster.module';
|
|
26
|
+
import { CommTemplateController } from './controller/comm-template.controller';
|
|
27
|
+
import { CommTemplateRepository } from './repository/comm-template.repository';
|
|
28
|
+
import { ActionEntity } from './entity/action.entity';
|
|
29
|
+
import { StageGroupRepository } from './repository/stage-group.repository';
|
|
30
|
+
import { StageGroupController } from './controller/stage-group.controller';
|
|
31
|
+
import { StageController } from './controller/stage.controller';
|
|
32
|
+
import { StageRepository } from './repository/stage.repository';
|
|
27
33
|
|
|
28
34
|
@Module({
|
|
29
35
|
imports: [
|
|
30
36
|
TypeOrmModule.forFeature([
|
|
31
37
|
Workflow,
|
|
32
|
-
|
|
38
|
+
ActionEntity,
|
|
33
39
|
ActionCategory,
|
|
34
40
|
Stage,
|
|
35
41
|
StageGroup,
|
|
@@ -54,6 +60,10 @@ import { ListMasterModule } from '../listmaster/listmaster.module';
|
|
|
54
60
|
WorkflowListMasterService,
|
|
55
61
|
ActionTemplateMappingService,
|
|
56
62
|
WorkflowRepository,
|
|
63
|
+
CommTemplateService,
|
|
64
|
+
CommTemplateRepository,
|
|
65
|
+
StageGroupRepository,
|
|
66
|
+
StageRepository,
|
|
57
67
|
],
|
|
58
68
|
exports: [
|
|
59
69
|
'ActionCategoryService',
|
|
@@ -63,11 +73,16 @@ import { ListMasterModule } from '../listmaster/listmaster.module';
|
|
|
63
73
|
'StageService',
|
|
64
74
|
'StageGroupService',
|
|
65
75
|
WorkflowRepository,
|
|
76
|
+
StageGroupRepository,
|
|
77
|
+
StageRepository,
|
|
66
78
|
],
|
|
67
79
|
controllers: [
|
|
68
80
|
WorkflowListMasterController,
|
|
69
81
|
ActionTemplateMappingController,
|
|
70
82
|
WorkflowController,
|
|
83
|
+
CommTemplateController,
|
|
84
|
+
StageGroupController,
|
|
85
|
+
StageController,
|
|
71
86
|
],
|
|
72
87
|
})
|
|
73
88
|
export class WorkflowModule {}
|