rez_core 2.2.35 → 2.2.37
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/dist/module/workflow/controller/stage.controller.d.ts +21 -1
- package/dist/module/workflow/repository/stage.repository.d.ts +24 -3
- package/dist/module/workflow/repository/stage.repository.js +16 -3
- package/dist/module/workflow/repository/stage.repository.js.map +1 -1
- package/dist/module/workflow/service/stage.service.d.ts +21 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/workflow/repository/stage.repository.ts +24 -2
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from '@nestjs/common';
|
|
7
7
|
import { StageGroup } from '../entity/stage-group.entity';
|
|
8
8
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
9
|
-
import { Repository } from 'typeorm';
|
|
9
|
+
import { DataSource, Repository } from 'typeorm';
|
|
10
10
|
import { Stage } from '../entity/stage.entity';
|
|
11
11
|
|
|
12
12
|
@Injectable()
|
|
@@ -14,6 +14,7 @@ export class StageRepository {
|
|
|
14
14
|
constructor(
|
|
15
15
|
@InjectRepository(Stage)
|
|
16
16
|
private readonly stageRepository: Repository<Stage>,
|
|
17
|
+
private readonly dataSource: DataSource,
|
|
17
18
|
) {}
|
|
18
19
|
|
|
19
20
|
async getAllStage(stage_group_id: number, organization_id: number) {
|
|
@@ -21,6 +22,21 @@ export class StageRepository {
|
|
|
21
22
|
throw new BadRequestException('stage_group_id is required');
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
// 1. Get stage group name
|
|
26
|
+
const stageGroup = (await this.dataSource.manager.findOne(
|
|
27
|
+
'cr_wf_stage_group',
|
|
28
|
+
{
|
|
29
|
+
where: { id: stage_group_id },
|
|
30
|
+
},
|
|
31
|
+
)) as StageGroup;
|
|
32
|
+
|
|
33
|
+
if (!stageGroup) {
|
|
34
|
+
throw new NotFoundException('Stage group not found');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const stageGroupName = stageGroup.name;
|
|
38
|
+
|
|
39
|
+
// 2. Get all stages under that group
|
|
24
40
|
const result = await this.stageRepository.find({
|
|
25
41
|
where: {
|
|
26
42
|
stage_group_id,
|
|
@@ -35,6 +51,12 @@ export class StageRepository {
|
|
|
35
51
|
return [];
|
|
36
52
|
}
|
|
37
53
|
|
|
38
|
-
|
|
54
|
+
// 3. Modify stage names
|
|
55
|
+
const updatedStages = result.map((stage) => ({
|
|
56
|
+
...stage,
|
|
57
|
+
name: `${stageGroupName} - ${stage.name}`,
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
return updatedStages;
|
|
39
61
|
}
|
|
40
62
|
}
|