rez_core 2.1.148 → 2.1.149
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/entity/base-entity.entity.js.map +1 -1
- package/dist/module/workflow/controller/comm-template.controller.d.ts +1 -1
- package/dist/module/workflow/controller/workflow-meta.controller.d.ts +9 -3
- package/dist/module/workflow/controller/workflow-meta.controller.js +17 -10
- package/dist/module/workflow/controller/workflow-meta.controller.js.map +1 -1
- package/dist/module/workflow/entity/stage-movement-data.entity.d.ts +2 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js +8 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js.map +1 -1
- package/dist/module/workflow/entity/workflow-level-mapping.entity.d.ts +7 -0
- package/dist/module/workflow/entity/workflow-level-mapping.entity.js +38 -0
- package/dist/module/workflow/entity/workflow-level-mapping.entity.js.map +1 -0
- package/dist/module/workflow/repository/stage-movement.repository.d.ts +19 -0
- package/dist/module/workflow/repository/stage-movement.repository.js +121 -0
- package/dist/module/workflow/repository/stage-movement.repository.js.map +1 -0
- package/dist/module/workflow/service/action.service.js +1 -1
- package/dist/module/workflow/service/action.service.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 +1 -1
- package/dist/module/workflow/service/comm-template.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-meta.service.d.ts +10 -5
- package/dist/module/workflow/service/workflow-meta.service.js +47 -22
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/module/workflow/workflow.module.js +4 -0
- 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/meta/entity/base-entity.entity.ts +1 -1
- package/src/module/workflow/controller/workflow-meta.controller.ts +29 -5
- package/src/module/workflow/entity/stage-movement-data.entity.ts +6 -0
- package/src/module/workflow/entity/workflow-level-mapping.entity.ts +18 -0
- package/src/module/workflow/repository/stage-movement.repository.ts +181 -0
- package/src/module/workflow/service/action.service.ts +1 -1
- package/src/module/workflow/service/comm-template.service.ts +1 -1
- package/src/module/workflow/service/workflow-meta.service.ts +79 -24
- package/src/module/workflow/workflow.module.ts +4 -0
package/package.json
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Controller,
|
|
3
|
+
Get,
|
|
4
|
+
Query,
|
|
5
|
+
Post,
|
|
6
|
+
Body,
|
|
7
|
+
Req,
|
|
8
|
+
UseGuards,
|
|
9
|
+
} from '@nestjs/common';
|
|
2
10
|
import { WorkflowMetaService } from '../service/workflow-meta.service';
|
|
3
11
|
import { StageMovementData } from '../entity/stage-movement-data.entity';
|
|
12
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
4
13
|
|
|
5
14
|
@Controller('workflow-meta')
|
|
15
|
+
@UseGuards(JwtAuthGuard)
|
|
6
16
|
export class WorkflowMetaController {
|
|
7
17
|
constructor(private readonly workflowMetaService: WorkflowMetaService) {}
|
|
8
18
|
|
|
@@ -13,8 +23,15 @@ export class WorkflowMetaController {
|
|
|
13
23
|
async getCurrentStage(
|
|
14
24
|
@Query('entityType') mapped_entity_type: string,
|
|
15
25
|
@Query('entityId') mapped_entity_id: number,
|
|
26
|
+
@Req() req: Request & { user: any },
|
|
16
27
|
): Promise<StageMovementData | null> {
|
|
17
|
-
|
|
28
|
+
let loggedInUser = req.user.userData;
|
|
29
|
+
|
|
30
|
+
return this.workflowMetaService.getCurrentStage(
|
|
31
|
+
mapped_entity_type,
|
|
32
|
+
Number(mapped_entity_id),
|
|
33
|
+
loggedInUser,
|
|
34
|
+
);
|
|
18
35
|
}
|
|
19
36
|
|
|
20
37
|
/**
|
|
@@ -24,8 +41,14 @@ export class WorkflowMetaController {
|
|
|
24
41
|
async getNextStage(
|
|
25
42
|
@Query('entityType') mapped_entity_type: string,
|
|
26
43
|
@Query('entityId') mapped_entity_id: number,
|
|
44
|
+
@Req() req: Request & { user: any },
|
|
27
45
|
): Promise<number | null> {
|
|
28
|
-
const
|
|
46
|
+
const loggedInUser = req.user.userData;
|
|
47
|
+
const current = await this.workflowMetaService.getCurrentStage(
|
|
48
|
+
mapped_entity_type,
|
|
49
|
+
Number(mapped_entity_id),
|
|
50
|
+
loggedInUser,
|
|
51
|
+
);
|
|
29
52
|
return current ? this.workflowMetaService.getNextStage(current) : null;
|
|
30
53
|
}
|
|
31
54
|
|
|
@@ -41,12 +64,13 @@ export class WorkflowMetaController {
|
|
|
41
64
|
async moveToNextStage(
|
|
42
65
|
@Body('entityType') mapped_entity_type: string,
|
|
43
66
|
@Body('entityId') mapped_entity_id: number,
|
|
44
|
-
@
|
|
67
|
+
@Req() req: Request & { user: any },
|
|
45
68
|
): Promise<string> {
|
|
69
|
+
const loggedInUser = req.user.userData;
|
|
46
70
|
return this.workflowMetaService.moveToNextStage(
|
|
47
71
|
mapped_entity_type,
|
|
48
72
|
Number(mapped_entity_id),
|
|
49
|
-
|
|
73
|
+
loggedInUser,
|
|
50
74
|
);
|
|
51
75
|
}
|
|
52
76
|
}
|
|
@@ -15,6 +15,12 @@ export class StageMovementData extends BaseEntity {
|
|
|
15
15
|
@Column({ type: 'int', nullable: true })
|
|
16
16
|
stage_action_mapping_id: number;
|
|
17
17
|
|
|
18
|
+
@Column({ type: 'int', nullable: true })
|
|
19
|
+
stage_group_id: number;
|
|
20
|
+
|
|
21
|
+
@Column({ type: 'int', nullable: true })
|
|
22
|
+
stage_id: number;
|
|
23
|
+
|
|
18
24
|
@Column({ type: 'date', nullable: true })
|
|
19
25
|
start_date: Date;
|
|
20
26
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'cr_workflow_level_mapping' })
|
|
4
|
+
export class WorkflowLevelMappingEntity {
|
|
5
|
+
constructor() {}
|
|
6
|
+
|
|
7
|
+
@PrimaryGeneratedColumn()
|
|
8
|
+
id: number;
|
|
9
|
+
|
|
10
|
+
@Column({ nullable: true })
|
|
11
|
+
workflow_id: number;
|
|
12
|
+
|
|
13
|
+
@Column({ nullable: true })
|
|
14
|
+
mapped_level_id: string;
|
|
15
|
+
|
|
16
|
+
@Column({ nullable: true })
|
|
17
|
+
mapped_level_type: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { get } from 'http';
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
4
|
+
import { Repository, DataSource, MoreThan } from 'typeorm';
|
|
5
|
+
import { WorkflowLevelMappingEntity } from '../entity/workflow-level-mapping.entity';
|
|
6
|
+
import { StageGroup } from '../entity/stage-group.entity';
|
|
7
|
+
import { Stage } from '../entity/stage.entity';
|
|
8
|
+
import { log } from 'console';
|
|
9
|
+
|
|
10
|
+
@Injectable()
|
|
11
|
+
export class StageMovementRepository {
|
|
12
|
+
constructor(
|
|
13
|
+
@InjectRepository(WorkflowLevelMappingEntity)
|
|
14
|
+
private readonly workflowLevelMappingRepo: Repository<WorkflowLevelMappingEntity>,
|
|
15
|
+
@InjectRepository(StageGroup)
|
|
16
|
+
private readonly stageGroupRepo: Repository<StageGroup>,
|
|
17
|
+
@InjectRepository(Stage)
|
|
18
|
+
private readonly stageRepo: Repository<Stage>,
|
|
19
|
+
private readonly dataSource: DataSource,
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
async getFirstStage({
|
|
23
|
+
loggedInUser,
|
|
24
|
+
mapped_entity_type,
|
|
25
|
+
mapped_entity_id,
|
|
26
|
+
}: {
|
|
27
|
+
loggedInUser: any;
|
|
28
|
+
mapped_entity_type: string;
|
|
29
|
+
mapped_entity_id: string | number;
|
|
30
|
+
}): Promise<any | null> {
|
|
31
|
+
// Try finding mapping at user's level
|
|
32
|
+
let workflowLevelMapping = await this.workflowLevelMappingRepo.findOne({
|
|
33
|
+
where: {
|
|
34
|
+
mapped_level_type: loggedInUser.level_type,
|
|
35
|
+
mapped_level_id: loggedInUser.level_id,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// If not found, fallback to organization-level mapping
|
|
40
|
+
if (!workflowLevelMapping) {
|
|
41
|
+
workflowLevelMapping = await this.workflowLevelMappingRepo.findOne({
|
|
42
|
+
where: {
|
|
43
|
+
mapped_level_type: 'ORG',
|
|
44
|
+
mapped_level_id: loggedInUser.organization_id,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// If still not found, return null
|
|
50
|
+
if (!workflowLevelMapping) return null;
|
|
51
|
+
|
|
52
|
+
// Find the stage group for this workflow
|
|
53
|
+
const stageGroup = await this.stageGroupRepo.findOne({
|
|
54
|
+
where: {
|
|
55
|
+
workflow_id: workflowLevelMapping.workflow_id,
|
|
56
|
+
},
|
|
57
|
+
order: { id: 'ASC' }, // Ensure you get the earliest/first group if needed
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (!stageGroup) return null;
|
|
61
|
+
|
|
62
|
+
// Find the first stage within this group
|
|
63
|
+
const firstStage = await this.stageRepo.findOne({
|
|
64
|
+
where: {
|
|
65
|
+
stage_group_id: stageGroup.id,
|
|
66
|
+
},
|
|
67
|
+
order: { id: 'ASC' }, // Change ordering as per your "first" logic
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (!firstStage) return null;
|
|
71
|
+
|
|
72
|
+
// Return comprehensive result
|
|
73
|
+
return {
|
|
74
|
+
mappingUsed: workflowLevelMapping,
|
|
75
|
+
stageGroup,
|
|
76
|
+
firstStage,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// async getNextStage(
|
|
81
|
+
// stageGroupId: number,
|
|
82
|
+
// currentStageId: number,
|
|
83
|
+
// ): Promise<any | null> {
|
|
84
|
+
// // 1. Get current stage to find its sequence number
|
|
85
|
+
// const currentStage = await this.stageRepo.findOne({
|
|
86
|
+
// where: { id: currentStageId, stage_group_id: stageGroupId },
|
|
87
|
+
// });
|
|
88
|
+
// if (!currentStage) return null;
|
|
89
|
+
|
|
90
|
+
// // 2. Find the next stage with sequence just after the current one
|
|
91
|
+
// const nextStage = await this.stageRepo.findOne({
|
|
92
|
+
// where: {
|
|
93
|
+
// stage_group_id: stageGroupId,
|
|
94
|
+
// sequence: MoreThan(currentStage.sequence),
|
|
95
|
+
// },
|
|
96
|
+
// order: { sequence: 'ASC' },
|
|
97
|
+
// });
|
|
98
|
+
|
|
99
|
+
// return nextStage || null;
|
|
100
|
+
// }
|
|
101
|
+
|
|
102
|
+
// async getNextStageGroup(
|
|
103
|
+
// currentStageGroupId: number,
|
|
104
|
+
// ): Promise<StageGroup | null> {
|
|
105
|
+
// // 1. Get current stage group
|
|
106
|
+
// const currentStageGroup = await this.stageGroupRepo.findOne({
|
|
107
|
+
// where: { id: currentStageGroupId },
|
|
108
|
+
// });
|
|
109
|
+
// if (!currentStageGroup) return null;
|
|
110
|
+
// // 2. Find the next stage group with a higher sequence
|
|
111
|
+
// const nextStageGroup = await this.stageGroupRepo.findOne({
|
|
112
|
+
// where: {
|
|
113
|
+
// sequence: MoreThan(currentStageGroup.sequence),
|
|
114
|
+
// },
|
|
115
|
+
// order: { sequence: 'ASC' }, // Get the immediate next
|
|
116
|
+
// });
|
|
117
|
+
// return nextStageGroup || null;
|
|
118
|
+
// }
|
|
119
|
+
|
|
120
|
+
async getNextStage(
|
|
121
|
+
stageGroupId: number,
|
|
122
|
+
currentStageId: number,
|
|
123
|
+
): Promise<any | null> {
|
|
124
|
+
const allStages = await this.stageRepo.find({
|
|
125
|
+
where: { stage_group_id: stageGroupId },
|
|
126
|
+
order: { sequence: 'ASC' },
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
if (currentStageId === 0) return allStages.length > 0 ? allStages[0] : null;
|
|
130
|
+
|
|
131
|
+
const currentStage = allStages.find((s) => s.id == currentStageId);
|
|
132
|
+
if (!currentStage) return null;
|
|
133
|
+
|
|
134
|
+
// Filter for stages with a greater sequence, then pick the smallest one
|
|
135
|
+
const higherStages = allStages
|
|
136
|
+
.filter((s) => s.sequence > currentStage.sequence)
|
|
137
|
+
.sort((a, b) => a.sequence - b.sequence);
|
|
138
|
+
|
|
139
|
+
return higherStages.length > 0 ? higherStages[0] : null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async getNextStageGroup(currentStageGroupId: number): Promise<any | null> {
|
|
143
|
+
const currentStageGroup = await this.stageGroupRepo.findOne({
|
|
144
|
+
where: { id: currentStageGroupId },
|
|
145
|
+
});
|
|
146
|
+
if (!currentStageGroup) return null;
|
|
147
|
+
|
|
148
|
+
//get workflow id of current stage group
|
|
149
|
+
const workflowId = currentStageGroup.workflow_id;
|
|
150
|
+
|
|
151
|
+
// Find the next stage group with a higher sequence
|
|
152
|
+
const nextStageGroup = await this.stageGroupRepo.findOne({
|
|
153
|
+
where: {
|
|
154
|
+
workflow_id: workflowId,
|
|
155
|
+
sequence: MoreThan(currentStageGroup.sequence),
|
|
156
|
+
},
|
|
157
|
+
order: { sequence: 'ASC' }, // Get the immediate next
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
return nextStageGroup || null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async getNextStageOrFirstOfNextGroup(
|
|
164
|
+
stageGroupId: number,
|
|
165
|
+
currentStageId: number,
|
|
166
|
+
): Promise<any | null> {
|
|
167
|
+
// 1. Try to get the next stage in same group
|
|
168
|
+
const nextStage = await this.getNextStage(stageGroupId, currentStageId);
|
|
169
|
+
if (nextStage) return nextStage;
|
|
170
|
+
|
|
171
|
+
// 2. No next stage. Try to get next stage group
|
|
172
|
+
const nextStageGroup = await this.getNextStageGroup(stageGroupId);
|
|
173
|
+
if (!nextStageGroup) return null;
|
|
174
|
+
|
|
175
|
+
const nextStageGroupFirstStage = await this.getNextStage(
|
|
176
|
+
nextStageGroup.id,
|
|
177
|
+
0,
|
|
178
|
+
);
|
|
179
|
+
return nextStageGroupFirstStage || null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -1,14 +1,38 @@
|
|
|
1
|
+
import { log } from 'console';
|
|
1
2
|
import { Injectable } from '@nestjs/common';
|
|
2
3
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
4
|
import { Repository } from 'typeorm';
|
|
4
5
|
import { StageMovementData } from '../entity/stage-movement-data.entity';
|
|
6
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
7
|
+
import { StageMovementRepository } from '../repository/stage-movement.repository';
|
|
8
|
+
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
5
9
|
|
|
6
10
|
@Injectable()
|
|
7
|
-
export class WorkflowMetaService {
|
|
11
|
+
export class WorkflowMetaService extends EntityServiceImpl {
|
|
8
12
|
constructor(
|
|
9
13
|
@InjectRepository(StageMovementData)
|
|
10
14
|
private readonly stageMovementRepo: Repository<StageMovementData>,
|
|
11
|
-
|
|
15
|
+
private readonly stageMovementRepository: StageMovementRepository,
|
|
16
|
+
) {
|
|
17
|
+
super();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// get first stage from stage table
|
|
21
|
+
async getFirstStage(
|
|
22
|
+
loggedInUser: UserData,
|
|
23
|
+
mapped_entity_type: string,
|
|
24
|
+
mapped_entity_id: number,
|
|
25
|
+
): Promise<any | null> {
|
|
26
|
+
// step1 find in workflow_level_mapping if not found with current level_id and level_type search in for ORG
|
|
27
|
+
// step2 find in stage_group => workflow_id
|
|
28
|
+
// step3 find in stage => stage_group_id
|
|
29
|
+
// step4 get first stage from stage table
|
|
30
|
+
return this.stageMovementRepository.getFirstStage({
|
|
31
|
+
loggedInUser,
|
|
32
|
+
mapped_entity_type,
|
|
33
|
+
mapped_entity_id,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
12
36
|
|
|
13
37
|
/**
|
|
14
38
|
* Get the current active stage for a given mapped entity
|
|
@@ -16,26 +40,37 @@ export class WorkflowMetaService {
|
|
|
16
40
|
async getCurrentStage(
|
|
17
41
|
mapped_entity_type: string,
|
|
18
42
|
mapped_entity_id: number,
|
|
19
|
-
|
|
20
|
-
|
|
43
|
+
loggedInUser: UserData,
|
|
44
|
+
): Promise<any | null> {
|
|
45
|
+
// Try to find the current stage movement entry
|
|
46
|
+
let currentStage = await this.stageMovementRepo.findOne({
|
|
21
47
|
where: {
|
|
22
48
|
mapped_entity_type,
|
|
23
49
|
mapped_entity_id,
|
|
24
50
|
is_current: 'Y',
|
|
25
51
|
},
|
|
26
52
|
});
|
|
53
|
+
|
|
54
|
+
// Return the found or newly created current stage movement
|
|
55
|
+
return currentStage;
|
|
27
56
|
}
|
|
28
57
|
|
|
29
58
|
/**
|
|
30
59
|
* Get next stage ID based on current stage
|
|
31
60
|
* (Stub logic – replace with real stage transition resolution)
|
|
32
61
|
*/
|
|
33
|
-
async getNextStage(currentStage:
|
|
34
|
-
//
|
|
35
|
-
const
|
|
36
|
-
|
|
62
|
+
async getNextStage(currentStage: any): Promise<any | null> {
|
|
63
|
+
// get all stage for that stage group
|
|
64
|
+
const nextStage =
|
|
65
|
+
await this.stageMovementRepository.getNextStageOrFirstOfNextGroup(
|
|
66
|
+
currentStage.stage_group_id,
|
|
67
|
+
currentStage.stage_id,
|
|
68
|
+
);
|
|
37
69
|
|
|
38
|
-
return
|
|
70
|
+
return {
|
|
71
|
+
hasNextStage: !!nextStage,
|
|
72
|
+
nextStage: nextStage,
|
|
73
|
+
};
|
|
39
74
|
}
|
|
40
75
|
|
|
41
76
|
/**
|
|
@@ -44,31 +79,47 @@ export class WorkflowMetaService {
|
|
|
44
79
|
async moveToNextStage(
|
|
45
80
|
mapped_entity_type: string,
|
|
46
81
|
mapped_entity_id: number,
|
|
47
|
-
|
|
82
|
+
loggedInUser: UserData,
|
|
48
83
|
): Promise<string> {
|
|
49
84
|
const now = new Date();
|
|
50
|
-
|
|
85
|
+
let currentStage = await this.getCurrentStage(
|
|
86
|
+
mapped_entity_type,
|
|
87
|
+
mapped_entity_id,
|
|
88
|
+
loggedInUser,
|
|
89
|
+
);
|
|
51
90
|
|
|
52
91
|
// Case 1: First stage – initialize
|
|
92
|
+
// If no current stage movement found, create one from the first stage
|
|
53
93
|
if (!currentStage) {
|
|
54
|
-
const
|
|
94
|
+
const getAllResult = await this.getFirstStage(
|
|
95
|
+
loggedInUser,
|
|
96
|
+
mapped_entity_type,
|
|
97
|
+
mapped_entity_id,
|
|
98
|
+
);
|
|
55
99
|
|
|
56
|
-
|
|
100
|
+
const { mappingUsed, stageGroup, firstStage } = getAllResult;
|
|
101
|
+
|
|
102
|
+
// Create a new current stage movement record
|
|
103
|
+
currentStage = await this.stageMovementRepo.save({
|
|
104
|
+
entity_type: 'STGM',
|
|
57
105
|
mapped_entity_type,
|
|
58
106
|
mapped_entity_id,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
107
|
+
name: firstStage.name,
|
|
108
|
+
status: firstStage.status,
|
|
109
|
+
current_user_id: loggedInUser.id,
|
|
110
|
+
stage_action_mapping_id: firstStage.id,
|
|
111
|
+
stage_group_id: stageGroup.id,
|
|
112
|
+
stage_id: firstStage.id,
|
|
113
|
+
start_date: new Date(),
|
|
62
114
|
is_current: 'Y',
|
|
63
115
|
});
|
|
64
|
-
|
|
65
|
-
return 'Workflow started with the first stage.';
|
|
66
116
|
}
|
|
67
117
|
|
|
68
118
|
// Case 2: Has next stage – move forward
|
|
69
|
-
const
|
|
119
|
+
const stageDate = await this.getNextStage(currentStage);
|
|
70
120
|
|
|
71
|
-
if (
|
|
121
|
+
if (stageDate.hasNextStage) {
|
|
122
|
+
const { nextStage } = stageDate;
|
|
72
123
|
// Close current stage
|
|
73
124
|
currentStage.end_date = now;
|
|
74
125
|
currentStage.is_current = 'N';
|
|
@@ -76,16 +127,20 @@ export class WorkflowMetaService {
|
|
|
76
127
|
|
|
77
128
|
// Insert next stage
|
|
78
129
|
await this.stageMovementRepo.save({
|
|
79
|
-
entity_type: '
|
|
130
|
+
entity_type: 'STGM',
|
|
80
131
|
mapped_entity_type,
|
|
81
132
|
mapped_entity_id,
|
|
82
|
-
|
|
83
|
-
|
|
133
|
+
name: nextStage.name,
|
|
134
|
+
status: nextStage.status,
|
|
135
|
+
current_user_id: loggedInUser.id,
|
|
136
|
+
stage_action_mapping_id: nextStage.id,
|
|
84
137
|
start_date: now,
|
|
138
|
+
stage_group_id: nextStage.stage_group_id,
|
|
139
|
+
stage_id: nextStage.id,
|
|
85
140
|
is_current: 'Y',
|
|
86
141
|
});
|
|
87
142
|
|
|
88
|
-
return `Moved to next stage (Stage ID: ${
|
|
143
|
+
return `Moved to next stage (Stage ID: ${nextStage.id}).`;
|
|
89
144
|
}
|
|
90
145
|
|
|
91
146
|
// Case 3: No next stage – mark workflow as done
|
|
@@ -39,6 +39,8 @@ import { WorkflowListMasterService } from './service/workflow-list-master.servic
|
|
|
39
39
|
import { WorkflowMetaService } from './service/workflow-meta.service';
|
|
40
40
|
import { WorkflowService } from './service/workflow.service';
|
|
41
41
|
import { ActionCategoryController } from './controller/action-category.controller';
|
|
42
|
+
import { StageMovementRepository } from './repository/stage-movement.repository';
|
|
43
|
+
import { WorkflowLevelMappingEntity } from './entity/workflow-level-mapping.entity';
|
|
42
44
|
|
|
43
45
|
@Module({
|
|
44
46
|
imports: [
|
|
@@ -54,6 +56,7 @@ import { ActionCategoryController } from './controller/action-category.controlle
|
|
|
54
56
|
StageMovementData,
|
|
55
57
|
EntityModification,
|
|
56
58
|
TemplateAttach,
|
|
59
|
+
WorkflowLevelMappingEntity,
|
|
57
60
|
]),
|
|
58
61
|
EntityModule,
|
|
59
62
|
ListMasterModule,
|
|
@@ -83,6 +86,7 @@ import { ActionCategoryController } from './controller/action-category.controlle
|
|
|
83
86
|
WorkflowService,
|
|
84
87
|
WorkflowMetaService,
|
|
85
88
|
PopulateWorkflowService,
|
|
89
|
+
StageMovementRepository,
|
|
86
90
|
],
|
|
87
91
|
exports: [
|
|
88
92
|
'ActionCategoryService',
|