rez_core 2.2.13 → 2.2.15

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.
Files changed (25) hide show
  1. package/dist/module/workflow/controller/action-category.controller.d.ts +3 -0
  2. package/dist/module/workflow/controller/action-category.controller.js +14 -0
  3. package/dist/module/workflow/controller/action-category.controller.js.map +1 -1
  4. package/dist/module/workflow/controller/form-master.controller.d.ts +11 -0
  5. package/dist/module/workflow/controller/form-master.controller.js +45 -0
  6. package/dist/module/workflow/controller/form-master.controller.js.map +1 -0
  7. package/dist/module/workflow/repository/form-master.repository.d.ts +11 -0
  8. package/dist/module/workflow/repository/form-master.repository.js +49 -0
  9. package/dist/module/workflow/repository/form-master.repository.js.map +1 -0
  10. package/dist/module/workflow/service/action-category.service.d.ts +1 -0
  11. package/dist/module/workflow/service/action-category.service.js +9 -0
  12. package/dist/module/workflow/service/action-category.service.js.map +1 -1
  13. package/dist/module/workflow/service/form-master.service.d.ts +10 -0
  14. package/dist/module/workflow/service/form-master.service.js +29 -0
  15. package/dist/module/workflow/service/form-master.service.js.map +1 -0
  16. package/dist/module/workflow/workflow.module.js +7 -0
  17. package/dist/module/workflow/workflow.module.js.map +1 -1
  18. package/dist/tsconfig.build.tsbuildinfo +1 -1
  19. package/package.json +1 -1
  20. package/src/module/workflow/controller/action-category.controller.ts +14 -0
  21. package/src/module/workflow/controller/form-master.controller.ts +35 -0
  22. package/src/module/workflow/repository/form-master.repository.ts +37 -0
  23. package/src/module/workflow/service/action-category.service.ts +14 -0
  24. package/src/module/workflow/service/form-master.service.ts +16 -0
  25. package/src/module/workflow/workflow.module.ts +7 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.2.13",
3
+ "version": "2.2.15",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -46,4 +46,18 @@ export class ActionCategoryController {
46
46
  );
47
47
  return result;
48
48
  }
49
+
50
+ @Post('/getactioncategorydata')
51
+ @HttpCode(HttpStatus.OK)
52
+ async getActionCategory(
53
+ @Req() req: Request & { user: any },
54
+ @Body('action_cat_id') action_cat_id: number,
55
+ ) {
56
+ const loggedInUser = req.user.userData;
57
+ const result = this.actionCategoryService.getActionCategory(
58
+ loggedInUser,
59
+ action_cat_id,
60
+ );
61
+ return result;
62
+ }
49
63
  }
@@ -0,0 +1,35 @@
1
+ import {
2
+ Body,
3
+ Controller,
4
+ HttpCode,
5
+ HttpStatus,
6
+ Inject,
7
+ Post,
8
+ Req,
9
+ UseGuards,
10
+ } from '@nestjs/common';
11
+ import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
12
+ import { FormMasterService } from '../service/form-master.service';
13
+
14
+ @Controller('/form')
15
+ @UseGuards(JwtAuthGuard)
16
+ export class FormMasterController {
17
+ constructor(
18
+ @Inject('FormMasterService')
19
+ private readonly formMasterService: FormMasterService,
20
+ ) {}
21
+
22
+ @Post('/getforms')
23
+ @HttpCode(HttpStatus.OK)
24
+ async getForms(
25
+ @Req() req: Request & { user: any },
26
+ @Body('source_entity_type') source_entity_type: string,
27
+ ) {
28
+ const loggedInUser = req.user.userData;
29
+ const result = this.formMasterService.getForms(
30
+ loggedInUser,
31
+ source_entity_type,
32
+ );
33
+ return result;
34
+ }
35
+ }
@@ -0,0 +1,37 @@
1
+ import {
2
+ BadRequestException,
3
+ Inject,
4
+ Injectable,
5
+ NotFoundException,
6
+ } from '@nestjs/common';
7
+ import { InjectRepository } from '@nestjs/typeorm';
8
+ import { DataSource, Repository } from 'typeorm';
9
+ import { FormMasterDataEntity } from '../entity/form-master.entity';
10
+
11
+ @Injectable()
12
+ export class FormMasterRepository {
13
+ constructor(
14
+ @InjectRepository(FormMasterDataEntity)
15
+ private readonly formMasterRepository: Repository<FormMasterDataEntity>,
16
+ private readonly dataSource: DataSource,
17
+ ) {}
18
+
19
+ async getForms(organization_id: number, source_entity_type: string) {
20
+ const forms = await this.dataSource
21
+ .createQueryBuilder()
22
+ .select(['fm.id', 'fm.form_name'])
23
+ .from('cr_form_master', 'fm')
24
+ .where('fm.organization_id = :orgId', { orgId: organization_id })
25
+ .andWhere('fm.source_entity_type = :sourceEntityType', {
26
+ sourceEntityType: source_entity_type,
27
+ })
28
+ .getRawMany();
29
+
30
+ const formatted = forms.map((form: any) => ({
31
+ label: form.fm_form_name,
32
+ value: form.fm_id,
33
+ }));
34
+
35
+ return formatted;
36
+ }
37
+ }
@@ -47,4 +47,18 @@ export class ActionCategoryService extends EntityServiceImpl {
47
47
  value: result?.[0]?.reason_code || null,
48
48
  };
49
49
  }
50
+
51
+ async getActionCategory(loggedInUser: UserData, action_cat_id: number) {
52
+ const { organization_id } = loggedInUser;
53
+ const result = await this.dataSource.query(
54
+ `
55
+ SELECT *
56
+ FROM cr_wf_action_category
57
+ WHERE organization_id = ? AND id = ?
58
+ `,
59
+ [organization_id, action_cat_id],
60
+ );
61
+
62
+ return result;
63
+ }
50
64
  }
@@ -0,0 +1,16 @@
1
+ import { Inject, Injectable } from '@nestjs/common';
2
+ import { FormMasterRepository } from '../repository/form-master.repository';
3
+ import { UserData } from 'src/module/user/entity/user.entity';
4
+
5
+ @Injectable()
6
+ export class FormMasterService {
7
+ constructor(private readonly formMasterRepository: FormMasterRepository) {}
8
+
9
+ async getForms(loggedInUser: UserData, source_entity_type: string) {
10
+ const { organization_id } = loggedInUser;
11
+ return this.formMasterRepository.getForms(
12
+ organization_id,
13
+ source_entity_type,
14
+ );
15
+ }
16
+ }
@@ -50,6 +50,9 @@ import { ActionRepository } from './repository/action.repository';
50
50
  import { ActionDataRepository } from './repository/action-data.repository';
51
51
  import { ActionDataService } from './service/action-data.service';
52
52
  import { FormMasterDataEntity } from './entity/form-master.entity';
53
+ import { FormMasterController } from './controller/form-master.controller';
54
+ import { FormMasterService } from './service/form-master.service';
55
+ import { FormMasterRepository } from './repository/form-master.repository';
53
56
 
54
57
  @Module({
55
58
  imports: [
@@ -89,6 +92,7 @@ import { FormMasterDataEntity } from './entity/form-master.entity';
89
92
  provide: 'EntityModificationService',
90
93
  useClass: EntityModificationService,
91
94
  },
95
+ { provide: 'FormMasterService', useClass: FormMasterService },
92
96
  WorkflowListMasterService,
93
97
  ActionTemplateMappingService,
94
98
  WorkflowRepository,
@@ -104,6 +108,7 @@ import { FormMasterDataEntity } from './entity/form-master.entity';
104
108
  ActionRepository,
105
109
  ActionDataRepository,
106
110
  ActionDataService,
111
+ FormMasterRepository,
107
112
  ],
108
113
  exports: [
109
114
  'ActionCategoryService',
@@ -113,6 +118,7 @@ import { FormMasterDataEntity } from './entity/form-master.entity';
113
118
  'StageService',
114
119
  'StageGroupService',
115
120
  'EntityModificationService',
121
+ 'FormMasterService',
116
122
  WorkflowRepository,
117
123
  StageGroupRepository,
118
124
  StageRepository,
@@ -131,6 +137,7 @@ import { FormMasterDataEntity } from './entity/form-master.entity';
131
137
  EntityModificationController,
132
138
  ActionCategoryController,
133
139
  TaskController,
140
+ FormMasterController,
134
141
  ],
135
142
  })
136
143
  export class WorkflowModule {}