rez_core 5.0.19 → 5.0.20

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.19",
3
+ "version": "5.0.20",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -6,14 +6,20 @@ import {
6
6
  } from '@nestjs/common';
7
7
  import { StageGroup } from '../entity/stage-group.entity';
8
8
  import { InjectRepository } from '@nestjs/typeorm';
9
- import { DataSource, Repository } from 'typeorm';
9
+ import { DataSource, In, Repository } from 'typeorm';
10
10
  import { MediaDataService } from 'src/module/meta/service/media-data.service';
11
+ import { Stage } from '../entity/stage.entity';
12
+ import { TaskDataEntity } from '../entity/task-data.entity';
11
13
 
12
14
  @Injectable()
13
15
  export class StageGroupRepository {
14
16
  constructor(
15
17
  @InjectRepository(StageGroup)
16
18
  private readonly stageGroupRepository: Repository<StageGroup>,
19
+ @InjectRepository(Stage)
20
+ private readonly stageRepository: Repository<Stage>,
21
+ @InjectRepository(TaskDataEntity)
22
+ private readonly taskDataRepo: Repository<TaskDataEntity>,
17
23
  private readonly dataSource: DataSource,
18
24
  private readonly mediaDataService: MediaDataService,
19
25
  ) {}
@@ -83,22 +89,16 @@ export class StageGroupRepository {
83
89
  // -------------------------------------------------------------
84
90
 
85
91
  const stageGroupIds = stageGroups.map((sg) => Number(sg.id));
86
- const stageGroupPlaceholders = stageGroupIds
87
- .map((_, idx) => `$${idx + 1}`)
88
- .join(", ");
89
-
90
- const params_stage = [...stageGroupIds, Number(loggedInUser.organization_id)];
91
92
 
92
- const stagesRaw = await this.dataSource.query(
93
- `
94
- SELECT frm_wf_stage.*
95
- FROM frm_wf_stage
96
- WHERE frm_wf_stage.stage_group_id IN (${stageGroupPlaceholders})
97
- AND frm_wf_stage.organization_id = $${stageGroupIds.length + 1}
98
- ORDER BY frm_wf_stage.sequence ASC
99
- `,
100
- params_stage,
101
- );
93
+ const stagesRaw: any[] = await this.stageRepository.find({
94
+ where: {
95
+ stage_group_id: In(stageGroupIds),
96
+ organization_id: loggedInUser.organization_id
97
+ },
98
+ order: {
99
+ sequence: 'ASC',
100
+ }
101
+ })
102
102
 
103
103
  const stageIds = stagesRaw.map((s) => Number(s.id));
104
104