rez_core 5.0.81 → 5.0.83

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.81",
3
+ "version": "5.0.83",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -248,46 +248,49 @@ export class ActionRepository {
248
248
  const actionIds = stageActions.map((sa) => sa.action_id);
249
249
 
250
250
  // Step 2: Fetch all actions with category details
251
- const actions = await this.dataSource
252
- .createQueryBuilder()
251
+ const actionRepo = this.reflectionHelper.getRepoService('ActionEntity');
252
+
253
+ const actions = await actionRepo
254
+ .createQueryBuilder("a")
253
255
  .select([
254
- 'a.id AS action_id',
255
- 'a.name AS action_name',
256
- 'a.reason_code AS action_reason_code',
257
- 'a.default_reason_code AS default_reason_code',
258
- 'a.default_value AS default_value',
259
- 'a.mode AS mode',
260
- 'a.action_category AS action_category_id',
261
- 'ac.reason_code AS category_reason_code',
262
- 'ac.modalname AS modalname',
263
- 'ac.logo AS logo',
264
- 'ac.name AS action_category_name',
265
- 'a.dependent_action_id AS dependent_action_id',
256
+ "a.id AS action_id",
257
+ "a.name AS action_name",
258
+ "a.reason_code AS action_reason_code",
259
+ "a.default_reason_code AS default_reason_code",
260
+ "a.default_value AS default_value",
261
+ "a.mode AS mode",
262
+ "a.action_category AS action_category_id",
263
+ "ac.reason_code AS category_reason_code",
264
+ "ac.modalname AS modalname",
265
+ "ac.logo AS logo",
266
+ "ac.name AS action_category_name",
267
+ "a.dependent_action_id AS dependent_action_id",
266
268
  ])
267
- .from('frm_wf_action', 'a')
268
269
  .leftJoin(
269
- 'frm_wf_action_category',
270
- 'ac',
271
- 'ac.id::text = a.action_category',
270
+ "frm_wf_action_category",
271
+ "ac",
272
+ "ac.id = a.action_category::bigint"
272
273
  )
273
- .where('a.organization_id = :orgId', { orgId: organization_id })
274
- .andWhere('a.id IN (:...actionIds)', { actionIds })
274
+ .where("a.organization_id = :orgId", { orgId: organization_id })
275
+ .andWhere("a.id IN (:...actionIds)", { actionIds })
276
+ .orderBy("a.sequence", "ASC")
275
277
  .getRawMany();
276
278
 
277
279
  // Step 3: Fetch action_data
278
- const actionData = await this.dataSource
279
- .createQueryBuilder()
280
+ const actionDataRepo = this.reflectionHelper.getRepoService('ActionDataEntity');
281
+
282
+ const actionData = await actionDataRepo
283
+ .createQueryBuilder("ad")
280
284
  .select([
281
- 'ad.action_id AS action_id',
282
- 'ad.is_current AS is_current',
283
- 'ad.is_mandatory AS is_mandatory',
284
- 'ad.is_done AS is_done',
285
+ "ad.action_id AS action_id",
286
+ "ad.is_current AS is_current",
287
+ "ad.is_mandatory AS is_mandatory",
288
+ "ad.is_done AS is_done",
285
289
  ])
286
- .from('frm_wf_action_data', 'ad')
287
- .where('ad.stage_id = :stageId', { stageId: stage_id })
288
- .andWhere('ad.action_id IN (:...actionIds)', { actionIds })
289
- .andWhere('ad.mapped_entity_id = :mapped_entity_id', { mapped_entity_id })
290
- .andWhere('ad.mapped_entity_type = :mapped_entity_type', {
290
+ .where("ad.stage_id = :stageId", { stageId: stage_id })
291
+ .andWhere("ad.action_id IN (:...actionIds)", { actionIds })
292
+ .andWhere("ad.mapped_entity_id = :mapped_entity_id", { mapped_entity_id })
293
+ .andWhere("ad.mapped_entity_type = :mapped_entity_type", {
291
294
  mapped_entity_type,
292
295
  })
293
296
  .getRawMany();
@@ -19,6 +19,7 @@ import { ActivityLogService } from './activity-log.service';
19
19
  import { EntityModificationService } from './entity-modification.service';
20
20
  import { TaskService } from './task.service';
21
21
  import { ActionCategory } from '../entity/action-category.entity';
22
+ import { StageGroup } from '../entity/stage-group.entity';
22
23
 
23
24
  @Injectable()
24
25
  export class WorkflowMetaService extends EntityServiceImpl {
@@ -38,6 +39,8 @@ export class WorkflowMetaService extends EntityServiceImpl {
38
39
  private readonly configService: ConfigService,
39
40
  @InjectRepository(ActionCategory)
40
41
  private readonly actionCategoryRepo: Repository<ActionCategory>,
42
+ @InjectRepository(StageGroup)
43
+ private readonly stageGroupRepo: Repository<StageGroup>,
41
44
  ) {
42
45
  super();
43
46
  }
@@ -88,25 +91,25 @@ export class WorkflowMetaService extends EntityServiceImpl {
88
91
 
89
92
  if (!latestMovement) return null;
90
93
 
91
- const getGroupName = await this.dataSource.query(
92
- `SELECT name FROM frm_wf_stage_group WHERE id = ${latestMovement?.stage_group_id}`,
93
- );
94
+ let stageGroup = await this.stageGroupRepo.findOne({
95
+ where: {id: latestMovement?.stage_group_id}
96
+ });
94
97
 
95
98
  return {
96
99
  ...latestMovement,
97
- stage_group_name: getGroupName[0]?.name,
100
+ stage_group_name: stageGroup?.name,
98
101
  };
99
102
  }
100
103
 
101
104
  // get group name for the current stage
102
- const getGroupName = await this.dataSource.query(
103
- `SELECT name FROM frm_wf_stage_group WHERE id = ${currentStage?.stage_group_id}`,
104
- );
105
+ const stageGroup = await this.stageGroupRepo.findOne({
106
+ where: {id: currentStage?.stage_group_id}
107
+ });
105
108
 
106
109
  // Return the found or newly created current stage movement
107
110
  return {
108
111
  ...currentStage,
109
- stage_group_name: getGroupName[0]?.name,
112
+ stage_group_name: stageGroup?.name,
110
113
  };
111
114
  }
112
115
 
@@ -126,13 +129,15 @@ export class WorkflowMetaService extends EntityServiceImpl {
126
129
  return { hasNextStage: false, nextStage: null };
127
130
  }
128
131
 
129
- const groupName = await this.dataSource.query(
130
- `SELECT name FROM frm_wf_stage_group WHERE id = ${nextStage?.stage_group_id}`,
131
- );
132
+ const stageGroup = await this.stageGroupRepo.findOne({
133
+ where: {
134
+ id: nextStage?.stage_group_id,
135
+ }
136
+ })
132
137
 
133
138
  return {
134
139
  hasNextStage: !!nextStage,
135
- nextStage: { ...nextStage, stage_group_name: groupName[0]?.name },
140
+ nextStage: { ...nextStage, stage_group_name: stageGroup?.name },
136
141
  };
137
142
  }
138
143