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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.2.138",
3
+ "version": "2.2.140",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -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
- LEFT JOIN cr_wf_stage s ON s.stage_group_id = g.id
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
- await this.stageRepository.getStageGroupsWithStagesByWorkflowId(
39
- stage_group_id,
40
- organization_id,
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
- const stageMovementData = await this.stageMovementRepo.find({
48
- where: {
49
- mapped_entity_type: 'LEAD',
50
- mapped_entity_id,
51
- },
52
- });
53
-
54
- // Build a lookup: stage_action_mapping_id → movement
55
- const stageMovementMap = new Map(
56
- stageMovementData.map((s) => [Number(s.stage_action_mapping_id), s]),
57
- );
58
-
59
- // 4. Fetch statuses (id → name map)
60
- const statusListMaster = await this.dataSource.query(
61
- `SELECT id, name
62
- FROM cr_list_master_items
63
- WHERE listtype = 'STS' AND organization_id = ?`,
64
- [organization_id],
65
- );
66
-
67
- const statusMap = new Map(
68
- statusListMaster.map((s) => [String(s.id), s.name]),
69
- );
70
-
71
- // 5. Enrich result but stop at is_current
72
- const result: any[] = [];
73
- for (const stage of allStageGrpData) {
74
- // Attach human-readable status
75
- stage.status = statusMap.get(String(stage.status)) || stage.status;
76
-
77
- // Attach is_current flag
78
- const movement = stageMovementMap.get(Number(stage.id));
79
- stage.is_current = movement ? movement.is_current === 'Y' : false;
80
- stage.full_name = `${stage.stage_group_name} - ${stage.name}`;
81
-
82
- result.push(stage);
83
-
84
- // stop once we hit the current stage
85
- if (stage.is_current) {
86
- break;
87
- }
88
- }
89
-
90
- return result;
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(
@@ -1,5 +0,0 @@
1
- {
2
- "recommendations": [
3
- "dbaeumer.vscode-eslint"
4
- ]
5
- }