rez_core 5.0.66 → 5.0.67

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": "5.0.66",
3
+ "version": "5.0.67",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -17,16 +17,18 @@ export class ActionRepository {
17
17
  private readonly actionRepository: Repository<ActionEntity>,
18
18
  private readonly dataSource: DataSource,
19
19
  private readonly reflectionHelper: ReflectionHelper,
20
- ) {}
20
+ ) {
21
+ }
21
22
 
22
23
  async getReasonCode(loggedInUser: UserData): Promise<any> {
23
24
  const { organization_id } = loggedInUser;
24
25
  const result = await this.dataSource.query(
25
26
  `
26
- SELECT name, type
27
- FROM frm_list_master
28
- WHERE organization_id = $1 AND source = 'master'
29
- `,
27
+ SELECT name, type
28
+ FROM frm_list_master
29
+ WHERE organization_id = $1
30
+ AND source = 'master'
31
+ `,
30
32
  [organization_id],
31
33
  );
32
34
 
@@ -45,10 +47,11 @@ export class ActionRepository {
45
47
  }
46
48
  const result = await this.dataSource.query(
47
49
  `
48
- SELECT name, id
49
- FROM frm_list_master_items
50
- WHERE listtype = $1 AND organization_id = $2
51
- `,
50
+ SELECT name, id
51
+ FROM frm_list_master_items
52
+ WHERE listtype = $1
53
+ AND organization_id = $2
54
+ `,
52
55
  [list_type, organization_id],
53
56
  );
54
57
 
@@ -67,9 +70,9 @@ export class ActionRepository {
67
70
  // Step 1: Get all action_ids for the provided stage_id
68
71
  const stageActions = await workflowStageActionRepo.find({
69
72
  where: {
70
- stage_id: stage_id
71
- }
72
- })
73
+ stage_id: stage_id,
74
+ },
75
+ });
73
76
  if (!stageActions?.length) return [];
74
77
 
75
78
  const actionIds = stageActions.map((sa) => sa.action_id);
@@ -80,9 +83,9 @@ export class ActionRepository {
80
83
 
81
84
  const templateMappings = await workflowActionTemplateMappingRepo.find({
82
85
  where: {
83
- stg_act_mapping_id: In(mappingIds)
84
- }
85
- })
86
+ stg_act_mapping_id: In(mappingIds),
87
+ },
88
+ });
86
89
 
87
90
  const templateCodes = templateMappings.map((tm) => tm.template_code);
88
91
 
@@ -95,8 +98,8 @@ export class ActionRepository {
95
98
  const templates = await workflowCommTemplateRepo.find({
96
99
  where: {
97
100
  code: In(templateCodes),
98
- organization_id: organization_id
99
- }
101
+ organization_id: organization_id,
102
+ },
100
103
  });
101
104
 
102
105
  templates.forEach((tpl) => {
@@ -176,14 +179,13 @@ export class ActionRepository {
176
179
  action_id?: number,
177
180
  ) {
178
181
  // Step 1: Get all action_ids for the provided stage_id
179
- const stageActions = await this.dataSource.query(
180
- `
181
- SELECT action_id
182
- FROM frm_wf_stage_action_mapping
183
- WHERE stage_id = $1
184
- `,
185
- [stage_id],
186
- );
182
+ let stageActionMappingRepo = this.reflectionHelper.getRepoService('StageActionMapping');
183
+
184
+ const stageActions = await stageActionMappingRepo.find({
185
+ where: {
186
+ stage_id: stage_id,
187
+ },
188
+ });
187
189
 
188
190
  if (!stageActions?.length) return [];
189
191
 
@@ -200,12 +202,12 @@ export class ActionRepository {
200
202
  return [];
201
203
  }
202
204
 
203
- actionResults = await this.dataSource
204
- .createQueryBuilder()
205
- .select(['a.id AS action_id', 'a.name AS action_name'])
206
- .from('frm_wf_action', 'a')
207
- .andWhere('a.id IN(:...actionIds)', { actionIds: filteredActionIds })
208
- .getRawMany();
205
+ const actionRepo = this.reflectionHelper.getRepoService('ActionEntity');
206
+ actionResults = await actionRepo.find({
207
+ where: {
208
+ id: In(actionIds)
209
+ }
210
+ });
209
211
 
210
212
  // Step 3: Format result
211
213
  const enrichedResult = actionResults.map((row) => ({