rez_core 2.2.34 → 2.2.36
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/meta/controller/attribute-master.controller.d.ts +15 -0
- package/dist/module/meta/controller/attribute-master.controller.js +63 -0
- package/dist/module/meta/controller/attribute-master.controller.js.map +1 -0
- package/dist/module/meta/repository/attribute-master.repository.d.ts +3 -0
- package/dist/module/meta/repository/attribute-master.repository.js +10 -0
- package/dist/module/meta/repository/attribute-master.repository.js.map +1 -1
- package/dist/module/meta/service/attribute-master.service.d.ts +6 -1
- package/dist/module/meta/service/attribute-master.service.js +18 -0
- package/dist/module/meta/service/attribute-master.service.js.map +1 -1
- package/dist/module/meta/service/view-master.service.d.ts +1 -0
- package/dist/module/meta/service/view-master.service.js +3 -0
- package/dist/module/meta/service/view-master.service.js.map +1 -1
- package/dist/module/module/repository/menu.repository.js +1 -0
- package/dist/module/module/repository/menu.repository.js.map +1 -1
- package/dist/module/workflow/controller/stage-group.controller.d.ts +25 -0
- package/dist/module/workflow/controller/stage-group.controller.js +13 -0
- package/dist/module/workflow/controller/stage-group.controller.js.map +1 -1
- package/dist/module/workflow/controller/stage.controller.d.ts +21 -1
- package/dist/module/workflow/repository/stage-group.repository.d.ts +24 -2
- package/dist/module/workflow/repository/stage-group.repository.js +33 -2
- package/dist/module/workflow/repository/stage-group.repository.js.map +1 -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-group.service.d.ts +21 -0
- package/dist/module/workflow/service/stage-group.service.js +3 -0
- package/dist/module/workflow/service/stage-group.service.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/meta/controller/attribute-master.controller.ts +51 -0
- package/src/module/meta/repository/attribute-master.repository.ts +21 -0
- package/src/module/meta/service/attribute-master.service.ts +40 -1
- package/src/module/meta/service/view-master.service.ts +8 -37
- package/src/module/module/repository/menu.repository.ts +1 -0
- package/src/module/workflow/controller/stage-group.controller.ts +16 -0
- package/src/module/workflow/repository/stage-group.repository.ts +51 -1
- package/src/module/workflow/repository/stage.repository.ts +24 -2
- package/src/module/workflow/service/stage-group.service.ts +10 -0
- package/src/resources/dev.properties.yaml +4 -4
package/package.json
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Controller,
|
|
3
|
+
Post,
|
|
4
|
+
Body,
|
|
5
|
+
Param,
|
|
6
|
+
Req,
|
|
7
|
+
} from '@nestjs/common';
|
|
8
|
+
import { Request } from 'express';
|
|
9
|
+
import { AttributeMasterService } from '../service/attribute-master.service';
|
|
10
|
+
|
|
11
|
+
@Controller('attribute-master')
|
|
12
|
+
export class AttributeMasterController {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly attributeMasterService: AttributeMasterService,
|
|
15
|
+
) {}
|
|
16
|
+
|
|
17
|
+
@Post("/create")
|
|
18
|
+
async createAttribute(
|
|
19
|
+
@Body() attributeData: any,
|
|
20
|
+
@Req() req: Request & { user: any },
|
|
21
|
+
) {
|
|
22
|
+
let loggedInUser = req.user.userData;
|
|
23
|
+
return await this.attributeMasterService.createAttribute(
|
|
24
|
+
attributeData,
|
|
25
|
+
loggedInUser,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Post('update/:id')
|
|
30
|
+
async updateAttribute(
|
|
31
|
+
@Body() attributeData: any,
|
|
32
|
+
@Param('id') id: number,
|
|
33
|
+
@Req() req: Request & { user: any },
|
|
34
|
+
) {
|
|
35
|
+
let loggedInUser = req.user.userData;
|
|
36
|
+
return await this.attributeMasterService.updateAttribute(
|
|
37
|
+
attributeData,
|
|
38
|
+
id,
|
|
39
|
+
loggedInUser,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Post('getById/:id')
|
|
44
|
+
async getAttributeById(
|
|
45
|
+
@Param('id') id: number,
|
|
46
|
+
@Req() req: Request & { user: any },
|
|
47
|
+
) {
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
@@ -40,4 +40,25 @@ export class AttributeMasterRepository {
|
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
async createAttribute(
|
|
45
|
+
attributeData: AttributeMaster,
|
|
46
|
+
): Promise<AttributeMaster> {
|
|
47
|
+
return await this.attributeMasterRepository.save(attributeData);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async updateAttribute(
|
|
51
|
+
attributeData: AttributeMaster,
|
|
52
|
+
id: number,
|
|
53
|
+
): Promise<AttributeMaster | null> {
|
|
54
|
+
await this.attributeMasterRepository.update({ id }, attributeData);
|
|
55
|
+
return this.attributeMasterRepository.findOne({ where: { id } });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async getAttributeById(
|
|
59
|
+
id: number,
|
|
60
|
+
): Promise<AttributeMaster | null> {
|
|
61
|
+
return await this.attributeMasterRepository.findOne({ where: { id } });
|
|
62
|
+
}
|
|
63
|
+
|
|
43
64
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { AttributeMasterRepository } from '../repository/attribute-master.repository';
|
|
3
3
|
import { UserData } from 'src/module/user/entity/user.entity';
|
|
4
|
+
import { EntityServiceImpl } from './entity-service-impl.service';
|
|
5
|
+
import { AttributeMaster } from '../entity/attribute-master.entity';
|
|
4
6
|
|
|
5
7
|
@Injectable()
|
|
6
|
-
export class AttributeMasterService
|
|
8
|
+
export class AttributeMasterService {
|
|
7
9
|
constructor(
|
|
8
10
|
private readonly attributeMasterRepository: AttributeMasterRepository,
|
|
9
11
|
) {}
|
|
@@ -17,4 +19,41 @@ export class AttributeMasterService {
|
|
|
17
19
|
loggedInUser,
|
|
18
20
|
);
|
|
19
21
|
}
|
|
22
|
+
|
|
23
|
+
async createAttribute(
|
|
24
|
+
attributeData: AttributeMaster,
|
|
25
|
+
loggedInUser: UserData,
|
|
26
|
+
): Promise<AttributeMaster> {
|
|
27
|
+
attributeData.organization_id = loggedInUser.organization_id;
|
|
28
|
+
attributeData.level_type = loggedInUser.level_type;
|
|
29
|
+
attributeData.level_id = loggedInUser.level_id;
|
|
30
|
+
return await this.attributeMasterRepository.createAttribute(attributeData);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async updateAttribute(
|
|
34
|
+
attributeData: AttributeMaster,
|
|
35
|
+
id: number,
|
|
36
|
+
loggedInUser: UserData,
|
|
37
|
+
): Promise<AttributeMaster | null> {
|
|
38
|
+
attributeData.organization_id = loggedInUser.organization_id;
|
|
39
|
+
attributeData.level_type = loggedInUser.level_type;
|
|
40
|
+
attributeData.level_id = loggedInUser.level_id;
|
|
41
|
+
return await this.attributeMasterRepository.updateAttribute(attributeData, id);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async getAttributeById(
|
|
45
|
+
id: number,
|
|
46
|
+
): Promise<AttributeMaster | null> {
|
|
47
|
+
return await this.attributeMasterRepository.getAttributeById(id);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async getAttributesByMappedEntityType(
|
|
51
|
+
entityType: string,
|
|
52
|
+
loggedInUser: UserData,
|
|
53
|
+
): Promise<AttributeMaster[]> {
|
|
54
|
+
return await this.attributeMasterRepository.findAttributesByMappedEntityType(
|
|
55
|
+
entityType,
|
|
56
|
+
loggedInUser,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
20
59
|
}
|
|
@@ -37,43 +37,6 @@ export class ViewMasterService extends EntityServiceImpl {
|
|
|
37
37
|
manager,
|
|
38
38
|
);
|
|
39
39
|
|
|
40
|
-
// let viewMaster = savedEntity as ViewMaster;
|
|
41
|
-
// if (entityData.type === 'form') {
|
|
42
|
-
// let layout = viewMaster.published_form_layout;
|
|
43
|
-
|
|
44
|
-
// const stepsData = this.sectionMasterService.parseLayout(layout);
|
|
45
|
-
// for (var step of stepsData) {
|
|
46
|
-
// let sectionMaster = new SectionMaster();
|
|
47
|
-
// sectionMaster.name = step.stepLabel;
|
|
48
|
-
// sectionMaster.position = step.stepPosition;
|
|
49
|
-
// sectionMaster.description = step.stepLabel;
|
|
50
|
-
// sectionMaster.parent_id = viewMaster.id;
|
|
51
|
-
// sectionMaster.parent_type = viewMaster.entity_type;
|
|
52
|
-
|
|
53
|
-
// const savedSectionMaster = await this.sectionMasterService.createEntity(
|
|
54
|
-
// sectionMaster,
|
|
55
|
-
// loggedInUser,
|
|
56
|
-
// manager,
|
|
57
|
-
// );
|
|
58
|
-
|
|
59
|
-
// const fieldGroups = step.fieldsGroup;
|
|
60
|
-
|
|
61
|
-
// for (var fieldGroup of fieldGroups) {
|
|
62
|
-
// let fieldsGroup = new FieldGroup();
|
|
63
|
-
// fieldsGroup.view_id = viewMaster.id;
|
|
64
|
-
// fieldsGroup.parent_id = savedSectionMaster.id;
|
|
65
|
-
// fieldsGroup.field_type = fieldGroup.type;
|
|
66
|
-
// fieldsGroup.label = fieldGroup.label;
|
|
67
|
-
// fieldsGroup.description = fieldGroup.label;
|
|
68
|
-
|
|
69
|
-
// this.fieldGroupService.createEntity(
|
|
70
|
-
// fieldsGroup,
|
|
71
|
-
// loggedInUser,
|
|
72
|
-
// manager,
|
|
73
|
-
// );
|
|
74
|
-
// }
|
|
75
|
-
// }
|
|
76
|
-
// }
|
|
77
40
|
return savedEntity;
|
|
78
41
|
}
|
|
79
42
|
|
|
@@ -101,4 +64,12 @@ export class ViewMasterService extends EntityServiceImpl {
|
|
|
101
64
|
};
|
|
102
65
|
}
|
|
103
66
|
}
|
|
67
|
+
|
|
68
|
+
async getEntityData(
|
|
69
|
+
entityType: string,
|
|
70
|
+
id: number,
|
|
71
|
+
loggedInUserData?: UserData | null,
|
|
72
|
+
) {
|
|
73
|
+
return await super.getEntityData(entityType, id,loggedInUserData);
|
|
74
|
+
}
|
|
104
75
|
}
|
|
@@ -77,6 +77,7 @@ export class MenuRepository extends Repository<MenuData> {
|
|
|
77
77
|
.where('menu.module_code IN (:...moduleCodes)', { moduleCodes })
|
|
78
78
|
.andWhere('LOWER(menu.appcode) = LOWER(:appcode)', { appcode })
|
|
79
79
|
.andWhere('menu.level_type = :levelType', { levelType })
|
|
80
|
+
.andWhere('menu.ui_visible = 1')
|
|
80
81
|
.select([
|
|
81
82
|
'menu.*',
|
|
82
83
|
'module.component_name AS component',
|
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
Body,
|
|
3
3
|
Controller,
|
|
4
4
|
Get,
|
|
5
|
+
HttpCode,
|
|
6
|
+
HttpStatus,
|
|
5
7
|
Inject,
|
|
6
8
|
Post,
|
|
7
9
|
Req,
|
|
@@ -29,4 +31,18 @@ export class StageGroupController {
|
|
|
29
31
|
organization_id,
|
|
30
32
|
);
|
|
31
33
|
}
|
|
34
|
+
|
|
35
|
+
@Post('/get-all-stage-groups-and-stages')
|
|
36
|
+
@HttpCode(HttpStatus.OK)
|
|
37
|
+
async getAllStageGroupAndStageHierarchy(
|
|
38
|
+
@Req() req: Request & { user: any },
|
|
39
|
+
@Body() body: { workflow_id: number },
|
|
40
|
+
) {
|
|
41
|
+
const loggedInUser = req.user.userData;
|
|
42
|
+
|
|
43
|
+
return this.stageGroupService.getAllStageGroupAndStageHierarchy(
|
|
44
|
+
body.workflow_id,
|
|
45
|
+
loggedInUser.organization_id,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
32
48
|
}
|
|
@@ -6,13 +6,14 @@ 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
|
|
|
11
11
|
@Injectable()
|
|
12
12
|
export class StageGroupRepository {
|
|
13
13
|
constructor(
|
|
14
14
|
@InjectRepository(StageGroup)
|
|
15
15
|
private readonly stageGroupRepository: Repository<StageGroup>,
|
|
16
|
+
private readonly dataSource: DataSource,
|
|
16
17
|
) {}
|
|
17
18
|
|
|
18
19
|
async getAllStageGroup(workflow_id: number, organization_id: number) {
|
|
@@ -38,4 +39,53 @@ export class StageGroupRepository {
|
|
|
38
39
|
|
|
39
40
|
return result;
|
|
40
41
|
}
|
|
42
|
+
|
|
43
|
+
async getAllStageGroupAndStageHierarchy(
|
|
44
|
+
workflow_id: number,
|
|
45
|
+
organization_id: number,
|
|
46
|
+
) {
|
|
47
|
+
if (!workflow_id) {
|
|
48
|
+
throw new BadRequestException('workflow_id is required');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Step 1: Get all stage groups
|
|
52
|
+
const stageGroups = await this.getAllStageGroup(
|
|
53
|
+
workflow_id,
|
|
54
|
+
organization_id,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if (!stageGroups.length) return [];
|
|
58
|
+
|
|
59
|
+
// Step 2: Get all stages where stage_group_id IN (...)
|
|
60
|
+
const stageGroupIds = stageGroups.map((sg) => sg.id);
|
|
61
|
+
|
|
62
|
+
const stages = await this.dataSource.query(
|
|
63
|
+
`
|
|
64
|
+
SELECT * FROM cr_wf_stage
|
|
65
|
+
WHERE stage_group_id IN (${stageGroupIds.map(() => '?').join(',')})
|
|
66
|
+
AND organization_id = ?
|
|
67
|
+
ORDER BY sequence ASC
|
|
68
|
+
`,
|
|
69
|
+
[...stageGroupIds, organization_id],
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
// Step 3: Group stages by stage_group_id
|
|
73
|
+
const stageMap = new Map<number, any[]>();
|
|
74
|
+
for (const stage of stages) {
|
|
75
|
+
if (!stageMap.has(stage.stage_group_id)) {
|
|
76
|
+
stageMap.set(stage.stage_group_id, []);
|
|
77
|
+
}
|
|
78
|
+
stageMap.get(stage.stage_group_id)?.push(stage);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Step 4: Attach stages to stage groups
|
|
82
|
+
const result = stageGroups.map((stageGroup) => {
|
|
83
|
+
return {
|
|
84
|
+
...stageGroup,
|
|
85
|
+
stages: stageMap.get(Number(stageGroup.id)) || [],
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
41
91
|
}
|
|
@@ -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
|
}
|
|
@@ -23,6 +23,16 @@ export class StageGroupService extends EntityServiceImpl {
|
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
async getAllStageGroupAndStageHierarchy(
|
|
27
|
+
workflow_id: number,
|
|
28
|
+
organization_id: number,
|
|
29
|
+
) {
|
|
30
|
+
return await this.stageGroupRepository.getAllStageGroupAndStageHierarchy(
|
|
31
|
+
workflow_id,
|
|
32
|
+
organization_id,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
async updateEntity(
|
|
27
37
|
entityData: BaseEntity,
|
|
28
38
|
loggedInUser: UserData,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
DB_HOST: 'localhost'
|
|
1
|
+
DB_HOST: "13.234.25.234"
|
|
2
|
+
# DB_HOST: 'localhost'
|
|
3
3
|
DB_PORT: '3306'
|
|
4
4
|
DB_USER: 'root'
|
|
5
|
-
DB_PASS: '
|
|
6
|
-
DB_NAME: '
|
|
5
|
+
DB_PASS: 'Rezolut@123'
|
|
6
|
+
DB_NAME: 'package_core'
|
|
7
7
|
MASTER_KEY: '0QZ2eRJv5oVILYnyBlC+FbSGVQiWKReh'
|
|
8
8
|
MASTER_IV: 'heuUQf5uPVtkotrFAOKUVw=='
|
|
9
9
|
SECRET_KEY: '1hard_to_guess_secret7890a'
|