rez_core 2.1.151 → 2.1.152

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.1.151",
3
+ "version": "2.1.152",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -293,7 +293,7 @@ export class ActionService extends EntityServiceImpl {
293
293
  'ar.name AS action_requirement',
294
294
  ])
295
295
  .from('cr_wf_action', 'a')
296
- .leftJoin('cr_wf_action_category', 'ac', 'ac.id = a.action_cat_id')
296
+ .leftJoin('cr_wf_action_category', 'ac', 'ac.id = a.action_category')
297
297
  .leftJoin(
298
298
  'cr_list_master_items',
299
299
  'ar',
@@ -18,7 +18,7 @@ export class WorkflowListMasterService extends EntityServiceImpl {
18
18
  a.action_requirement AS actionRequirement
19
19
  FROM cr_wf_stage_action_mapping sam
20
20
  JOIN cr_wf_action a ON sam.action_id = a.id
21
- JOIN cr_wf_action_category ac ON a.action_cat_id = ac.id
21
+ JOIN cr_wf_action_category ac ON a.action_category = ac.id
22
22
  WHERE sam.stage_id = ?
23
23
  `,
24
24
  [stageId],
@@ -1,7 +1,7 @@
1
1
  import { log } from 'console';
2
2
  import { Injectable } from '@nestjs/common';
3
3
  import { InjectRepository } from '@nestjs/typeorm';
4
- import { Repository } from 'typeorm';
4
+ import { Repository, DataSource } from 'typeorm';
5
5
  import { StageMovementData } from '../entity/stage-movement-data.entity';
6
6
  import { UserData } from 'src/module/user/entity/user.entity';
7
7
  import { StageMovementRepository } from '../repository/stage-movement.repository';
@@ -13,6 +13,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
13
13
  @InjectRepository(StageMovementData)
14
14
  private readonly stageMovementRepo: Repository<StageMovementData>,
15
15
  private readonly stageMovementRepository: StageMovementRepository,
16
+ private readonly dataSource: DataSource,
16
17
  ) {
17
18
  super();
18
19
  }
@@ -51,8 +52,21 @@ export class WorkflowMetaService extends EntityServiceImpl {
51
52
  },
52
53
  });
53
54
 
55
+ if (!currentStage) {
56
+ // If no current stage found, return null
57
+ return null;
58
+ }
59
+
60
+ // get group name for the current stage
61
+ const getGroupName = await this.dataSource.query(
62
+ `SELECT name FROM cr_wf_stage_group WHERE id = ${currentStage?.stage_group_id}`,
63
+ );
64
+
54
65
  // Return the found or newly created current stage movement
55
- return currentStage;
66
+ return {
67
+ ...currentStage,
68
+ stage_group_name: getGroupName[0]?.name,
69
+ };
56
70
  }
57
71
 
58
72
  /**
@@ -63,13 +77,21 @@ export class WorkflowMetaService extends EntityServiceImpl {
63
77
  // get all stage for that stage group
64
78
  const nextStage =
65
79
  await this.stageMovementRepository.getNextStageOrFirstOfNextGroup(
66
- currentStage.stage_group_id,
67
- currentStage.stage_id,
80
+ currentStage?.stage_group_id,
81
+ currentStage?.stage_id,
68
82
  );
69
83
 
84
+ if (!nextStage) {
85
+ return { hasNextStage: false, nextStage: null };
86
+ }
87
+
88
+ const groupName = await this.dataSource.query(
89
+ `SELECT name FROM cr_wf_stage_group WHERE id = ${nextStage?.stage_group_id}`,
90
+ );
91
+
70
92
  return {
71
93
  hasNextStage: !!nextStage,
72
- nextStage: nextStage,
94
+ nextStage: { ...nextStage, stage_group_name: groupName[0]?.name },
73
95
  };
74
96
  }
75
97
 
@@ -141,7 +163,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
141
163
  current_user_id: loggedInUser.id,
142
164
  stage_action_mapping_id: nextStage.id,
143
165
  start_date: now,
144
- stage_group_id: nextStage.stage_group_id,
166
+ stage_group_id: nextStage?.stage_group_id,
145
167
  stage_id: nextStage.id,
146
168
  is_current: 'Y',
147
169
  });