rez_core 2.1.142 → 2.1.143

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 (29) hide show
  1. package/dist/constant/global.constant.d.ts +1 -1
  2. package/dist/constant/global.constant.js +1 -1
  3. package/dist/constant/global.constant.js.map +1 -1
  4. package/dist/module/workflow/controller/action.controller.d.ts +13 -0
  5. package/dist/module/workflow/controller/action.controller.js +58 -0
  6. package/dist/module/workflow/controller/action.controller.js.map +1 -0
  7. package/dist/module/workflow/controller/workflow.controller.d.ts +1 -3
  8. package/dist/module/workflow/controller/workflow.controller.js +0 -11
  9. package/dist/module/workflow/controller/workflow.controller.js.map +1 -1
  10. package/dist/module/workflow/entity/stage.entity.d.ts +1 -0
  11. package/dist/module/workflow/entity/stage.entity.js +4 -0
  12. package/dist/module/workflow/entity/stage.entity.js.map +1 -1
  13. package/dist/module/workflow/service/action.service.d.ts +2 -0
  14. package/dist/module/workflow/service/action.service.js +28 -0
  15. package/dist/module/workflow/service/action.service.js.map +1 -1
  16. package/dist/module/workflow/service/comm-template.service.d.ts +2 -1
  17. package/dist/module/workflow/service/comm-template.service.js +3 -1
  18. package/dist/module/workflow/service/comm-template.service.js.map +1 -1
  19. package/dist/module/workflow/workflow.module.js +2 -0
  20. package/dist/module/workflow/workflow.module.js.map +1 -1
  21. package/dist/tsconfig.build.tsbuildinfo +1 -1
  22. package/package.json +1 -1
  23. package/src/constant/global.constant.ts +1 -1
  24. package/src/module/workflow/controller/action.controller.ts +44 -0
  25. package/src/module/workflow/controller/workflow.controller.ts +1 -6
  26. package/src/module/workflow/entity/stage.entity.ts +3 -0
  27. package/src/module/workflow/service/action.service.ts +41 -1
  28. package/src/module/workflow/service/comm-template.service.ts +5 -4
  29. package/src/module/workflow/workflow.module.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.1.142",
3
+ "version": "2.1.143",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -46,7 +46,7 @@ export const STAGE = 'STG';
46
46
  export const STAGE_GROUP = 'STGP';
47
47
  export const ACTION_CATEGORY = 'ACTC';
48
48
  export const STAGE_ACTION_MAPPING = 'STGM';
49
- export const COMM_TEMPLATE = 'CTPL';
49
+ export const COMM_TEMPLATE = 'TEM';
50
50
  export const ACTION_TEMPLATE_MAPPING = 'ATMP';
51
51
  export const WORKFLOW_DATA = 'WFDT';
52
52
  export const STAGE_MOVEMENT_DATA = 'STMV';
@@ -0,0 +1,44 @@
1
+ import {
2
+ Body,
3
+ Controller,
4
+ Get,
5
+ HttpCode,
6
+ HttpStatus,
7
+ Inject,
8
+ Post,
9
+ Req,
10
+ UseGuards,
11
+ } from '@nestjs/common';
12
+ import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
13
+ import { ActionService } from '../service/action.service';
14
+
15
+ @Controller('/action')
16
+ @UseGuards(JwtAuthGuard)
17
+ export class ActionController {
18
+ constructor(
19
+ @Inject('ActionService')
20
+ private readonly actionService: ActionService,
21
+ ) {}
22
+
23
+ @Get('/getReasonCode')
24
+ @HttpCode(HttpStatus.OK)
25
+ async getReasonCode(@Req() req: Request & { user: any }) {
26
+ const loggedInUser = req.user.userData;
27
+ const result = this.actionService.getReasonCode(loggedInUser);
28
+ return result;
29
+ }
30
+
31
+ @Post('/defaultReasonCode')
32
+ @HttpCode(HttpStatus.OK)
33
+ async defaultReasonCode(
34
+ @Req() req: Request & { user: any },
35
+ @Body() body: { list_type: string },
36
+ ) {
37
+ const loggedInUser = req.user.userData;
38
+ const result = this.actionService.defaultReasonCode(
39
+ body.list_type,
40
+ loggedInUser,
41
+ );
42
+ return result;
43
+ }
44
+ }
@@ -42,12 +42,7 @@ export class WorkflowController {
42
42
  async getWorkflowById(@Param('id') id: number) {
43
43
  return this.workflowService.getWorkflowById(id);
44
44
  }
45
-
46
- @Delete('/deleteWorkflow/:id')
47
- @HttpCode(HttpStatus.OK)
48
- async deleteWorkflow(@Param('id') id: number) {
49
- return this.workflowService.deleteWorkflowById(id);
50
- }
45
+ SS;
51
46
 
52
47
  @Put('/updateSequence')
53
48
  @HttpCode(HttpStatus.OK)
@@ -14,4 +14,7 @@ export class Stage extends BaseEntity {
14
14
 
15
15
  @Column({ type: 'int', nullable: true })
16
16
  sequence: number;
17
+
18
+ @Column({ type: 'varchar', nullable: true })
19
+ description: string;
17
20
  }
@@ -1,4 +1,4 @@
1
- import { Injectable } from '@nestjs/common';
1
+ import { BadRequestException, Injectable } from '@nestjs/common';
2
2
  import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
3
  import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
4
4
  import { UserData } from 'src/module/user/entity/user.entity';
@@ -169,4 +169,44 @@ export class ActionService extends EntityServiceImpl {
169
169
 
170
170
  return deleteAction;
171
171
  }
172
+
173
+ async getReasonCode(loggedInUser: UserData): Promise<any> {
174
+ const { organization_id } = loggedInUser;
175
+ const result = await this.dataSource.query(
176
+ `
177
+ SELECT name, type
178
+ FROM cr_list_master
179
+ WHERE organization_id = ? AND source = 'master'
180
+ `,
181
+ [organization_id],
182
+ );
183
+
184
+ const formatted = result.map((item: any) => ({
185
+ label: item.name,
186
+ value: item.type,
187
+ }));
188
+
189
+ return formatted;
190
+ }
191
+
192
+ async defaultReasonCode(list_type: string, loggedInUser: UserData) {
193
+ const { organization_id } = loggedInUser;
194
+ if (!list_type) {
195
+ throw new BadRequestException('list_type is required');
196
+ }
197
+ const result = await this.dataSource.query(
198
+ `
199
+ SELECT name, value
200
+ FROM cr_list_master_items
201
+ WHERE listtype = ? AND organization_id = ?
202
+ `,
203
+ [list_type, organization_id],
204
+ );
205
+
206
+ // Format as array of key-value pairs
207
+ return result.map((row: any) => ({
208
+ label: row.value,
209
+ value: row.name,
210
+ }));
211
+ }
172
212
  }
@@ -1,11 +1,12 @@
1
1
  import { Injectable } from '@nestjs/common';
2
2
  import { CommTemplateRepository } from '../repository/comm-template.repository';
3
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
4
 
4
5
  @Injectable()
5
- export class CommTemplateService {
6
- constructor(
7
- private readonly commTemplateRepository: CommTemplateRepository,
8
- ) {}
6
+ export class CommTemplateService extends EntityServiceImpl {
7
+ constructor(private readonly commTemplateRepository: CommTemplateRepository) {
8
+ super();
9
+ }
9
10
 
10
11
  async getAllCommTemplate(entity_type: string, loggedInUser) {
11
12
  const commTemplateData =
@@ -21,7 +21,6 @@ import { WorkflowListMasterController } from './controller/workflow-list-master.
21
21
  import { ActionTemplateMappingController } from './controller/action-template-mapping.controller';
22
22
  import { WorkflowController } from './controller/workflow.controller';
23
23
  import { WorkflowRepository } from './repository/workflow.repository';
24
- import { ListMasterService } from '../listmaster/service/list-master.service';
25
24
  import { ListMasterModule } from '../listmaster/listmaster.module';
26
25
  import { CommTemplateController } from './controller/comm-template.controller';
27
26
  import { CommTemplateRepository } from './repository/comm-template.repository';
@@ -30,6 +29,7 @@ import { StageGroupRepository } from './repository/stage-group.repository';
30
29
  import { StageGroupController } from './controller/stage-group.controller';
31
30
  import { StageController } from './controller/stage.controller';
32
31
  import { StageRepository } from './repository/stage.repository';
32
+ import { ActionController } from './controller/action.controller';
33
33
 
34
34
  @Module({
35
35
  imports: [
@@ -83,6 +83,7 @@ import { StageRepository } from './repository/stage.repository';
83
83
  CommTemplateController,
84
84
  StageGroupController,
85
85
  StageController,
86
+ ActionController,
86
87
  ],
87
88
  })
88
89
  export class WorkflowModule {}