rez_core 2.2.141 → 2.2.142

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.141",
3
+ "version": "2.2.142",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -23,17 +23,11 @@ export class StageController {
23
23
  @Post('/getAllStage')
24
24
  async getAllStage(
25
25
  @Req() req: Request & { user: any },
26
- @Body()
27
- body: {
28
- stage_group_id: number;
29
- mapped_entity_id: number;
30
- mapped_entity_type: string;
31
- },
26
+ @Body() body: { stage_group_id: number },
32
27
  ) {
33
28
  const { organization_id } = req.user.userData;
34
29
  return this.stageGroupService.getAllStage(
35
30
  body.stage_group_id,
36
- body.mapped_entity_id,
37
31
  organization_id,
38
32
  );
39
33
  }
@@ -55,7 +55,7 @@ export class StageRepository {
55
55
  const updatedStages = result.map((stage) => ({
56
56
  ...stage,
57
57
  name: stage.name,
58
- fullName: `${stageGroupName} - ${stage.name}`,
58
+ full_name: `${stageGroupName} - ${stage.name}`,
59
59
  }));
60
60
 
61
61
  return updatedStages;
@@ -28,67 +28,29 @@ export class StageService extends EntityServiceImpl {
28
28
  super();
29
29
  }
30
30
 
31
- async getAllStage(
32
- stage_group_id: number,
33
- mapped_entity_id: number,
34
- organization_id: number,
35
- ) {
36
- // 1. Get all stages under the given stage_group_id
37
- const allStageGrpData = await this.stageRepository.getAllStage(
31
+ async getAllStage(stage_group_id: number, organization_id: number) {
32
+ const allStages = await this.stageRepository.getAllStage(
38
33
  stage_group_id,
39
34
  organization_id,
40
35
  );
41
36
 
42
- if (allStageGrpData.length === 0) {
43
- return [];
37
+ const statusListMaster = await this.dataSource.query(
38
+ `SELECT id, name
39
+ FROM cr_list_master_items
40
+ WHERE listtype = 'STS' AND organization_id = ?`,
41
+ [organization_id],
42
+ );
43
+
44
+ // Build a lookup map: id → name
45
+ const statusMap = new Map(
46
+ statusListMaster.map((s) => [String(s.id), s.name]),
47
+ );
48
+
49
+ for (const stage of allStages) {
50
+ stage.status = statusMap.get(String(stage.status)) as any;
44
51
  }
45
52
 
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;
53
+ return allStages;
92
54
  }
93
55
 
94
56
  async updateEntity(