rez_core 2.2.138 → 2.2.140
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/stage.controller.d.ts +22 -1
- package/dist/module/workflow/repository/stage.repository.js +4 -3
- package/dist/module/workflow/repository/stage.repository.js.map +1 -1
- package/dist/module/workflow/service/stage.service.d.ts +22 -1
- package/dist/module/workflow/service/stage.service.js +2 -24
- package/dist/module/workflow/service/stage.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/workflow/repository/stage.repository.ts +18 -3
- package/src/module/workflow/service/stage.service.ts +50 -49
- package/.vscode/extensions.json +0 -5
package/package.json
CHANGED
|
@@ -88,12 +88,27 @@ export class StageRepository {
|
|
|
88
88
|
g.id as stage_group_id, g.name as stage_group_name, g.workflow_id,
|
|
89
89
|
s.*
|
|
90
90
|
FROM cr_wf_stage_group g
|
|
91
|
-
|
|
92
|
-
WHERE g.workflow_id = ? AND g.organization_id = ?
|
|
91
|
+
INNER JOIN cr_wf_stage s ON s.stage_group_id = g.id
|
|
92
|
+
WHERE g.workflow_id = ? AND g.organization_id = ? AND g.id = ?
|
|
93
93
|
ORDER BY g.id, s.id
|
|
94
94
|
`,
|
|
95
|
-
[stageGroup.workflow_id, organization_id],
|
|
95
|
+
[stageGroup.workflow_id, organization_id, stage_group_id],
|
|
96
96
|
);
|
|
97
|
+
// const rows2 = await this.dataSource.query(
|
|
98
|
+
// `
|
|
99
|
+
// SELECT
|
|
100
|
+
// g.id as stage_group_id, g.name as stage_group_name, g.workflow_id,
|
|
101
|
+
// s.*
|
|
102
|
+
// FROM cr_wf_stage_group g
|
|
103
|
+
// INNER JOIN cr_wf_stage s ON s.stage_group_id = g.id
|
|
104
|
+
// WHERE g.workflow_id = ? AND g.organization_id = ?
|
|
105
|
+
// ORDER BY g.id, s.id
|
|
106
|
+
// `,
|
|
107
|
+
// [stageGroup.workflow_id, organization_id],
|
|
108
|
+
// );
|
|
109
|
+
|
|
110
|
+
console.log(rows, '-----------LEFT JOIN----------');
|
|
111
|
+
// console.log(rows2, '-----------INNER JOIN----------');
|
|
97
112
|
|
|
98
113
|
if (!rows || rows.length === 0) {
|
|
99
114
|
return [];
|
|
@@ -34,60 +34,61 @@ export class StageService extends EntityServiceImpl {
|
|
|
34
34
|
organization_id: number,
|
|
35
35
|
) {
|
|
36
36
|
// 1. Get all stages under the given stage_group_id
|
|
37
|
-
const allStageGrpData =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
);
|
|
37
|
+
const allStageGrpData = await this.stageRepository.getAllStage(
|
|
38
|
+
stage_group_id,
|
|
39
|
+
organization_id,
|
|
40
|
+
);
|
|
42
41
|
|
|
43
42
|
if (allStageGrpData.length === 0) {
|
|
44
43
|
return [];
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
46
|
+
return allStageGrpData;
|
|
47
|
+
|
|
48
|
+
// const stageMovementData = await this.stageMovementRepo.find({
|
|
49
|
+
// where: {
|
|
50
|
+
// mapped_entity_type: 'LEAD',
|
|
51
|
+
// mapped_entity_id,
|
|
52
|
+
// },
|
|
53
|
+
// });
|
|
54
|
+
|
|
55
|
+
// // Build a lookup: stage_action_mapping_id → movement
|
|
56
|
+
// const stageMovementMap = new Map(
|
|
57
|
+
// stageMovementData.map((s) => [Number(s.stage_action_mapping_id), s]),
|
|
58
|
+
// );
|
|
59
|
+
|
|
60
|
+
// // 4. Fetch statuses (id → name map)
|
|
61
|
+
// const statusListMaster = await this.dataSource.query(
|
|
62
|
+
// `SELECT id, name
|
|
63
|
+
// FROM cr_list_master_items
|
|
64
|
+
// WHERE listtype = 'STS' AND organization_id = ?`,
|
|
65
|
+
// [organization_id],
|
|
66
|
+
// );
|
|
67
|
+
|
|
68
|
+
// const statusMap = new Map(
|
|
69
|
+
// statusListMaster.map((s) => [String(s.id), s.name]),
|
|
70
|
+
// );
|
|
71
|
+
|
|
72
|
+
// // 5. Enrich result but stop at is_current
|
|
73
|
+
// const result: any[] = [];
|
|
74
|
+
// for (const stage of allStageGrpData) {
|
|
75
|
+
// // Attach human-readable status
|
|
76
|
+
// stage.status = statusMap.get(String(stage.status)) || stage.status;
|
|
77
|
+
|
|
78
|
+
// // Attach is_current flag
|
|
79
|
+
// const movement = stageMovementMap.get(Number(stage.id));
|
|
80
|
+
// stage.is_current = movement ? movement.is_current === 'Y' : false;
|
|
81
|
+
// stage.full_name = `${stage.stage_group_name} - ${stage.name}`;
|
|
82
|
+
|
|
83
|
+
// result.push(stage);
|
|
84
|
+
|
|
85
|
+
// // stop once we hit the current stage
|
|
86
|
+
// if (stage.is_current) {
|
|
87
|
+
// break;
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
90
|
+
|
|
91
|
+
// return result;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
async updateEntity(
|