rez_core 2.1.108 → 2.1.110

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 (118) hide show
  1. package/dist/app.module.js +2 -0
  2. package/dist/app.module.js.map +1 -1
  3. package/dist/constant/global.constant.d.ts +8 -0
  4. package/dist/constant/global.constant.js +9 -1
  5. package/dist/constant/global.constant.js.map +1 -1
  6. package/dist/module/listmaster/controller/list-master.controller.d.ts +3 -0
  7. package/dist/module/listmaster/controller/list-master.controller.js +16 -0
  8. package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
  9. package/dist/module/listmaster/repository/list-master-items.repository.d.ts +1 -0
  10. package/dist/module/listmaster/repository/list-master-items.repository.js +3 -0
  11. package/dist/module/listmaster/repository/list-master-items.repository.js.map +1 -1
  12. package/dist/module/listmaster/service/list-master-item.service.d.ts +5 -2
  13. package/dist/module/listmaster/service/list-master-item.service.js +48 -3
  14. package/dist/module/listmaster/service/list-master-item.service.js.map +1 -1
  15. package/dist/module/master/controller/master.controller.js +0 -2
  16. package/dist/module/master/controller/master.controller.js.map +1 -1
  17. package/dist/module/master/service/master.service.js +4 -1
  18. package/dist/module/master/service/master.service.js.map +1 -1
  19. package/dist/module/meta/entity/attribute-master.entity.d.ts +1 -0
  20. package/dist/module/meta/entity/attribute-master.entity.js +4 -0
  21. package/dist/module/meta/entity/attribute-master.entity.js.map +1 -1
  22. package/dist/module/meta/repository/attribute-master.repository.d.ts +2 -1
  23. package/dist/module/meta/repository/attribute-master.repository.js +5 -3
  24. package/dist/module/meta/repository/attribute-master.repository.js.map +1 -1
  25. package/dist/module/meta/service/attribute-master.service.d.ts +2 -1
  26. package/dist/module/meta/service/attribute-master.service.js +2 -2
  27. package/dist/module/meta/service/attribute-master.service.js.map +1 -1
  28. package/dist/module/user/service/role.service.js +2 -2
  29. package/dist/module/user/service/role.service.js.map +1 -1
  30. package/dist/module/user/service/user.service.js +2 -2
  31. package/dist/module/user/service/user.service.js.map +1 -1
  32. package/dist/module/workflow/entity/action-category.entity.d.ts +4 -0
  33. package/dist/module/workflow/entity/action-category.entity.js +27 -0
  34. package/dist/module/workflow/entity/action-category.entity.js.map +1 -0
  35. package/dist/module/workflow/entity/action-template-mapping.entity.d.ts +6 -0
  36. package/dist/module/workflow/entity/action-template-mapping.entity.js +35 -0
  37. package/dist/module/workflow/entity/action-template-mapping.entity.js.map +1 -0
  38. package/dist/module/workflow/entity/action.entity.d.ts +7 -0
  39. package/dist/module/workflow/entity/action.entity.js +39 -0
  40. package/dist/module/workflow/entity/action.entity.js.map +1 -0
  41. package/dist/module/workflow/entity/comm-template.entity.d.ts +4 -0
  42. package/dist/module/workflow/entity/comm-template.entity.js +27 -0
  43. package/dist/module/workflow/entity/comm-template.entity.js.map +1 -0
  44. package/dist/module/workflow/entity/stage-action-mapping.entity.d.ts +6 -0
  45. package/dist/module/workflow/entity/stage-action-mapping.entity.js +35 -0
  46. package/dist/module/workflow/entity/stage-action-mapping.entity.js.map +1 -0
  47. package/dist/module/workflow/entity/stage-group.entity.d.ts +6 -0
  48. package/dist/module/workflow/entity/stage-group.entity.js +35 -0
  49. package/dist/module/workflow/entity/stage-group.entity.js.map +1 -0
  50. package/dist/module/workflow/entity/stage.entity.d.ts +6 -0
  51. package/dist/module/workflow/entity/stage.entity.js +35 -0
  52. package/dist/module/workflow/entity/stage.entity.js.map +1 -0
  53. package/dist/module/workflow/entity/workflow.entity.d.ts +5 -0
  54. package/dist/module/workflow/entity/workflow.entity.js +31 -0
  55. package/dist/module/workflow/entity/workflow.entity.js.map +1 -0
  56. package/dist/module/workflow/repository/workflow.repository.d.ts +2 -0
  57. package/dist/module/workflow/repository/workflow.repository.js +17 -0
  58. package/dist/module/workflow/repository/workflow.repository.js.map +1 -0
  59. package/dist/module/workflow/service/action-category.service.d.ts +3 -0
  60. package/dist/module/workflow/service/action-category.service.js +18 -0
  61. package/dist/module/workflow/service/action-category.service.js.map +1 -0
  62. package/dist/module/workflow/service/action-template-mapping.service.d.ts +3 -0
  63. package/dist/module/workflow/service/action-template-mapping.service.js +18 -0
  64. package/dist/module/workflow/service/action-template-mapping.service.js.map +1 -0
  65. package/dist/module/workflow/service/action.service.d.ts +8 -0
  66. package/dist/module/workflow/service/action.service.js +47 -0
  67. package/dist/module/workflow/service/action.service.js.map +1 -0
  68. package/dist/module/workflow/service/comm-template.service.d.ts +3 -0
  69. package/dist/module/workflow/service/comm-template.service.js +18 -0
  70. package/dist/module/workflow/service/comm-template.service.js.map +1 -0
  71. package/dist/module/workflow/service/stage-action-mapping.service.d.ts +3 -0
  72. package/dist/module/workflow/service/stage-action-mapping.service.js +18 -0
  73. package/dist/module/workflow/service/stage-action-mapping.service.js.map +1 -0
  74. package/dist/module/workflow/service/stage-group.service.d.ts +3 -0
  75. package/dist/module/workflow/service/stage-group.service.js +18 -0
  76. package/dist/module/workflow/service/stage-group.service.js.map +1 -0
  77. package/dist/module/workflow/service/stage.service.d.ts +3 -0
  78. package/dist/module/workflow/service/stage.service.js +18 -0
  79. package/dist/module/workflow/service/stage.service.js.map +1 -0
  80. package/dist/module/workflow/service/workflow.service.d.ts +4 -0
  81. package/dist/module/workflow/service/workflow.service.js +25 -0
  82. package/dist/module/workflow/service/workflow.service.js.map +1 -0
  83. package/dist/module/workflow/workflow.module.d.ts +2 -0
  84. package/dist/module/workflow/workflow.module.js +76 -0
  85. package/dist/module/workflow/workflow.module.js.map +1 -0
  86. package/dist/tsconfig.build.tsbuildinfo +1 -1
  87. package/package.json +1 -1
  88. package/src/app.module.ts +2 -0
  89. package/src/constant/global.constant.ts +10 -0
  90. package/src/module/listmaster/controller/list-master.controller.ts +18 -0
  91. package/src/module/listmaster/repository/list-master-items.repository.ts +4 -0
  92. package/src/module/listmaster/service/list-master-item.service.ts +99 -2
  93. package/src/module/master/controller/master.controller.ts +1 -1
  94. package/src/module/master/service/master.service.ts +5 -1
  95. package/src/module/meta/entity/attribute-master.entity.ts +3 -0
  96. package/src/module/meta/repository/attribute-master.repository.ts +6 -3
  97. package/src/module/meta/service/attribute-master.service.ts +6 -4
  98. package/src/module/user/service/role.service.ts +2 -2
  99. package/src/module/user/service/user.service.ts +2 -2
  100. package/src/module/workflow/entity/action-category.entity.ts +11 -0
  101. package/src/module/workflow/entity/action-template-mapping.entity.ts +17 -0
  102. package/src/module/workflow/entity/action.entity.ts +20 -0
  103. package/src/module/workflow/entity/comm-template.entity.ts +11 -0
  104. package/src/module/workflow/entity/stage-action-mapping.entity.ts +17 -0
  105. package/src/module/workflow/entity/stage-group.entity.ts +17 -0
  106. package/src/module/workflow/entity/stage.entity.ts +17 -0
  107. package/src/module/workflow/entity/workflow.entity.ts +14 -0
  108. package/src/module/workflow/repository/workflow.repository.ts +4 -0
  109. package/src/module/workflow/service/action-category.service.ts +5 -0
  110. package/src/module/workflow/service/action-template-mapping.service.ts +5 -0
  111. package/src/module/workflow/service/action.service.ts +51 -0
  112. package/src/module/workflow/service/comm-template.service.ts +5 -0
  113. package/src/module/workflow/service/stage-action-mapping.service.ts +5 -0
  114. package/src/module/workflow/service/stage-group.service.ts +5 -0
  115. package/src/module/workflow/service/stage.service.ts +5 -0
  116. package/src/module/workflow/service/workflow.service.ts +9 -0
  117. package/src/module/workflow/workflow.module.ts +63 -0
  118. package/src/resources/dev.properties.yaml +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.1.108",
3
+ "version": "2.1.110",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
package/src/app.module.ts CHANGED
@@ -13,6 +13,7 @@ import { ThirdPartyModule } from './module/third-party-module/third-party.module
13
13
  import { FilterModule } from './module/filter/filter.module';
14
14
  import { LeadModule } from './module/lead/lead.module';
15
15
  import { LayoutPreferenceModule } from './module/layout_preference/layout_preference.module';
16
+ import { WorkflowModule } from './module/workflow/workflow.module';
16
17
 
17
18
  @Module({
18
19
  imports: [
@@ -30,6 +31,7 @@ import { LayoutPreferenceModule } from './module/layout_preference/layout_prefer
30
31
  FilterModule,
31
32
  LeadModule,
32
33
  LayoutPreferenceModule,
34
+ WorkflowModule,
33
35
  ],
34
36
  })
35
37
  export class AppModule {}
@@ -34,3 +34,13 @@ export const ENTITYSTATUS_PUBLISHED = 'published';
34
34
  export const DISPLAY_LIST = 'LIST';
35
35
  export const DISPLAY_EXPORT = 'EXPORT';
36
36
  export const DISPLAY_REPORT = 'REPORT';
37
+
38
+ //WorkFlow Type
39
+ export const WORKFLOW = 'WRFW';
40
+ export const ACTION = 'ACTN';
41
+ export const STAGE = 'STG';
42
+ export const STAGE_GROUP = 'STGP';
43
+ export const ACTION_CATEGORY = 'ACTC';
44
+ export const STAGE_ACTION_MAPPING = 'STGM';
45
+ export const COMM_TEMPLATE = 'CTPL';
46
+ export const ACTION_TEMPLATE_MAPPING = 'ATMP';
@@ -50,6 +50,24 @@ export class ListMasterController {
50
50
  );
51
51
  }
52
52
 
53
+ @Post('/getResolvedListMasterItems/:type')
54
+ @UseGuards(JwtAuthGuard)
55
+ @HttpCode(HttpStatus.OK)
56
+ async getResolvedListMasterItems(
57
+ @Body() entityData: any,
58
+ @Param('type') type: string,
59
+ @Req() req: Request & { user: any },
60
+ ) {
61
+ const loggedInUser = req.user.userData;
62
+ const entityType = type;
63
+
64
+ return await this.listMasterItemService.getResolvedListMasterItems(
65
+ loggedInUser,
66
+ entityData,
67
+ entityType,
68
+ );
69
+ }
70
+
53
71
  @Get('/getListMasterItems/:type')
54
72
  @UseGuards(JwtAuthGuard)
55
73
  @HttpCode(HttpStatus.OK)
@@ -146,4 +146,8 @@ export class ListMasterItemsRepository {
146
146
  async delete(item: Partial<ListMasterItems>) {
147
147
  return this.repo.delete(item);
148
148
  }
149
+
150
+ async findById(id: number): Promise<ListMasterItems | null> {
151
+ return this.repo.findOne({ where: { id } });
152
+ }
149
153
  }
@@ -9,15 +9,19 @@ import { ListMasterItemsRepository } from '../repository/list-master-items.repos
9
9
  import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
10
10
  import { UserData } from 'src/module/user/entity/user.entity';
11
11
  import { CodeGeneratorService } from 'src/utils/service/codeGenerator.service';
12
+ import { AttributeMasterService } from 'src/module/meta/service/attribute-master.service';
12
13
 
13
14
  @Injectable()
14
- export class ListMasterItemService {
15
+ export class ListMasterItemService extends EntityServiceImpl {
15
16
  constructor(
16
17
  private readonly listItemsRepo: ListMasterItemsRepository,
17
18
  private readonly listMasterRepo: ListMasterItemsRepository,
18
19
  @Inject(forwardRef(() => EntityServiceImpl))
19
20
  private readonly entityServiceImpl: EntityServiceImpl,
20
- ) {}
21
+ private readonly attributeMasterService: AttributeMasterService,
22
+ ) {
23
+ super();
24
+ }
21
25
 
22
26
  async getListMasterItemsByType(
23
27
  listType: string,
@@ -178,4 +182,97 @@ export class ListMasterItemService {
178
182
  await this.listItemsRepo.delete({ code, listtype: listType });
179
183
  return `Item with name ${code} deleted successfully from type ${listType}`;
180
184
  }
185
+
186
+ // async getResolvedListMasterItems(
187
+ // loggedInUser: UserData,
188
+ // entityData: any,
189
+ // entityType: string,
190
+ // ): Promise<any> {
191
+ // const attributeItems =
192
+ // await this.attributeMasterService.findAttributesByMappedEntityType(
193
+ // entityType,
194
+ // loggedInUser,
195
+ // );
196
+
197
+ // const masterAttributes = attributeItems.filter(
198
+ // (attr) => attr.data_source_type === 'master',
199
+ // );
200
+
201
+ // const resolvedEntityData = { ...entityData };
202
+
203
+ // for (const attr of masterAttributes) {
204
+ // const field = attr.attribute_key;
205
+ // const codeValue = entityData[field];
206
+ // if (!codeValue) continue;
207
+
208
+ // const listItems = await this.listItemsRepo.findById(codeValue);
209
+ // if (!listItems) continue;
210
+
211
+ // }
212
+
213
+ // return resolvedEntityData;
214
+ // }
215
+
216
+ async getResolvedListMasterItems(
217
+ loggedInUser: UserData,
218
+ entityData: any,
219
+ entityType: string,
220
+ ): Promise<any> {
221
+ const attributeItems =
222
+ await this.attributeMasterService.findAttributesByMappedEntityType(
223
+ entityType,
224
+ loggedInUser,
225
+ );
226
+
227
+ const resolvedEntityData = { ...entityData };
228
+
229
+ for (const attr of attributeItems) {
230
+ const field = attr.attribute_key;
231
+ const codeValue = entityData[field];
232
+
233
+ if (!codeValue) continue;
234
+
235
+ // ---------- ENTITY data_source_type ----------
236
+ if (attr.data_source_type === 'entity') {
237
+ if (Array.isArray(codeValue)) {
238
+ const resolvedValues: string[] = [];
239
+ for (const code of codeValue) {
240
+ const item = await super.getEntityData(
241
+ attr.datasource_list,
242
+ code,
243
+ loggedInUser,
244
+ );
245
+ resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
246
+ }
247
+ resolvedEntityData[field] = resolvedValues;
248
+ } else {
249
+ const item = await super.getEntityData(
250
+ attr.datasource_list,
251
+ codeValue,
252
+ loggedInUser,
253
+ );
254
+ resolvedEntityData[field] =
255
+ item?.[attr.data_source_attribute] ?? codeValue;
256
+ }
257
+ }
258
+
259
+ // ---------- MASTER data_source_type ----------
260
+ else if (attr.data_source_type === 'master') {
261
+ if (Array.isArray(codeValue)) {
262
+ const resolvedValues: string[] = [];
263
+ for (const code of codeValue) {
264
+ const item = await this.listItemsRepo.findById(code);
265
+ resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
266
+ }
267
+ resolvedEntityData[field] = resolvedValues;
268
+ } else {
269
+ const item = await this.listItemsRepo.findById(codeValue);
270
+ resolvedEntityData[field] =
271
+ item?.[attr.data_source_attribute] ?? codeValue;
272
+ }
273
+ }
274
+ }
275
+
276
+ return resolvedEntityData;
277
+ }
181
278
  }
@@ -19,7 +19,7 @@ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.s
19
19
  import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
20
20
 
21
21
  @Controller('master')
22
- @UseGuards(JwtAuthGuard)
22
+ // @UseGuards(JwtAuthGuard)
23
23
  export class MasterController {
24
24
  constructor(
25
25
  private readonly masterService: MasterService,
@@ -161,9 +161,13 @@ export class MasterService {
161
161
  const entityMasterData =
162
162
  await this.entityMasterService.getEntityByTableName(table);
163
163
 
164
+ if (!entityMasterData) {
165
+ throw new Error(`Entity master not found for table: ${table}`);
166
+ }
167
+
164
168
  const attributes =
165
169
  await this.attributeMasterService.findAttributesByMappedEntityType(
166
- entityMasterData?.mapped_entity_type,
170
+ entityMasterData.mapped_entity_type,
167
171
  loggedInUser.organization_id,
168
172
  );
169
173
 
@@ -62,6 +62,9 @@ export class AttributeMaster extends BaseEntity {
62
62
  @Column({ name: 'is_unique', nullable: true })
63
63
  is_unique: number;
64
64
 
65
+ @Column({ name: 'data_source_attribute', nullable: true })
66
+ data_source_attribute: string;
67
+
65
68
  @Column({ name: 'regex', nullable: true })
66
69
  regex: string;
67
70
 
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
2
2
  import { InjectRepository } from '@nestjs/typeorm';
3
3
  import { AttributeMaster } from '../entity/attribute-master.entity';
4
4
  import { In, Repository } from 'typeorm';
5
+ import { UserData } from 'src/module/user/entity/user.entity';
5
6
 
6
7
  @Injectable()
7
8
  export class AttributeMasterRepository {
@@ -28,12 +29,14 @@ export class AttributeMasterRepository {
28
29
 
29
30
  async findAttributesByMappedEntityType(
30
31
  entityType: string,
31
- organizationId: number,
32
+ loggedInUser: UserData,
32
33
  ): Promise<AttributeMaster[]> {
33
34
  return await this.attributeMasterRepository.find({
34
35
  where: {
35
- mapped_entity_type: In([entityType, 'DEF']),
36
- organization_id: organizationId,
36
+ mapped_entity_type: In([entityType]),
37
+ organization_id: loggedInUser.organization_id,
38
+ level_type: loggedInUser.level_type,
39
+ level_id: loggedInUser.level_id,
37
40
  },
38
41
  });
39
42
  }
@@ -1,7 +1,6 @@
1
1
  import { Injectable } from '@nestjs/common';
2
- import { InjectRepository } from '@nestjs/typeorm';
3
- import { In } from 'typeorm';
4
2
  import { AttributeMasterRepository } from '../repository/attribute-master.repository';
3
+ import { UserData } from 'src/module/user/entity/user.entity';
5
4
 
6
5
  @Injectable()
7
6
  export class AttributeMasterService {
@@ -9,10 +8,13 @@ export class AttributeMasterService {
9
8
  private readonly attributeMasterRepository: AttributeMasterRepository,
10
9
  ) {}
11
10
 
12
- async findAttributesByMappedEntityType(entity_type, organization_id) {
11
+ async findAttributesByMappedEntityType(
12
+ entity_type: string,
13
+ loggedInUser: UserData,
14
+ ) {
13
15
  return await this.attributeMasterRepository.findAttributesByMappedEntityType(
14
16
  entity_type,
15
- organization_id,
17
+ loggedInUser,
16
18
  );
17
19
  }
18
20
  }
@@ -44,7 +44,7 @@ export class RoleService extends EntityServiceImpl {
44
44
  parseInt(loggedInUser?.level_id || '', 10),
45
45
  })
46
46
  ) {
47
- return { success: false, error: 'Role code already exists.' };
47
+ return { success: false, error: 'Role name already exists.' };
48
48
  }
49
49
 
50
50
  const sourceRole = role.copy_from_role_id
@@ -95,7 +95,7 @@ export class RoleService extends EntityServiceImpl {
95
95
  loggedInUser?.organization_id || 0,
96
96
  );
97
97
 
98
- if (entityData.status == resolveStatus.id || 'INACTIVE') {
98
+ if (entityData.status == resolveStatus.id) {
99
99
  //get role by id
100
100
  const existingRole = await this.getEntityData(
101
101
  ENTITYTYPE_ROLE,
@@ -47,7 +47,7 @@ export class UserService extends EntityServiceImpl {
47
47
 
48
48
  let existingUser = await this.userRepository.findByEmailId(
49
49
  userData.email_id,
50
- loggedInUser?.organization_id,
50
+ // loggedInUser?.organization_id,
51
51
  );
52
52
  if (existingUser) {
53
53
  return { success: false, error: 'User with this email already exists' };
@@ -55,7 +55,7 @@ export class UserService extends EntityServiceImpl {
55
55
 
56
56
  existingUser = await this.userRepository.findByMobile(
57
57
  userData.mobile,
58
- loggedInUser?.organization_id,
58
+ // loggedInUser?.organization_id,
59
59
  );
60
60
  if (existingUser) {
61
61
  return { success: false, error: 'User with this mobile already exists' };
@@ -0,0 +1,11 @@
1
+ import { ACTION_CATEGORY } from 'src/constant/global.constant';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { Entity } from 'typeorm';
4
+
5
+ @Entity({ name: 'cr_wf_action_category' })
6
+ export class ActionCategory extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = ACTION_CATEGORY;
10
+ }
11
+ }
@@ -0,0 +1,17 @@
1
+ import { ACTION_TEMPLATE_MAPPING } from 'src/constant/global.constant';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { Column, Entity } from 'typeorm';
4
+
5
+ @Entity({ name: 'cr_wf_action_template_mapping' })
6
+ export class ActionTemplateMapping extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = ACTION_TEMPLATE_MAPPING;
10
+ }
11
+
12
+ @Column({ type: 'int', nullable: true })
13
+ stg_act_mapping_id: number;
14
+
15
+ @Column({ type: 'int', nullable: true })
16
+ template_id: number;
17
+ }
@@ -0,0 +1,20 @@
1
+ import { ACTION } from 'src/constant/global.constant';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { Column, Entity } from 'typeorm';
4
+
5
+ @Entity({ name: 'cr_wf_action' })
6
+ export class Action extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = ACTION;
10
+ }
11
+
12
+ @Column({ type: 'int', nullable: true })
13
+ workflow_id: number;
14
+
15
+ @Column({ type: 'int', nullable: true })
16
+ action_cat_id: number;
17
+
18
+ @Column({ type: 'varchar', nullable: true })
19
+ action_requirement: string;
20
+ }
@@ -0,0 +1,11 @@
1
+ import { COMM_TEMPLATE } from 'src/constant/global.constant';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { Entity } from 'typeorm';
4
+
5
+ @Entity({ name: 'cr_wf_comm_template' })
6
+ export class CommTemplate extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = COMM_TEMPLATE;
10
+ }
11
+ }
@@ -0,0 +1,17 @@
1
+ import { STAGE_ACTION_MAPPING } from 'src/constant/global.constant';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { Column, Entity } from 'typeorm';
4
+
5
+ @Entity({ name: 'cr_wf_stage_action_mapping' })
6
+ export class StageActionMapping extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = STAGE_ACTION_MAPPING;
10
+ }
11
+
12
+ @Column({ type: 'int', nullable: true })
13
+ stage_id: number;
14
+
15
+ @Column({ type: 'int', nullable: true })
16
+ action_id: number;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { STAGE_GROUP } from 'src/constant/global.constant';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { Column, Entity } from 'typeorm';
4
+
5
+ @Entity({ name: 'cr_wf_stage_group' })
6
+ export class StageGroup extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = STAGE_GROUP;
10
+ }
11
+
12
+ @Column({ type: 'int', nullable: true })
13
+ workflow_id: number;
14
+
15
+ @Column({ type: 'int', nullable: true })
16
+ sortindex: number;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { STAGE } from 'src/constant/global.constant';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { Column, Entity } from 'typeorm';
4
+
5
+ @Entity({ name: 'cr_wf_stage' })
6
+ export class Stage extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = STAGE;
10
+ }
11
+
12
+ @Column({ type: 'int', nullable: true })
13
+ stage_group_id: number;
14
+
15
+ @Column({ type: 'int', nullable: true })
16
+ sortindex: number;
17
+ }
@@ -0,0 +1,14 @@
1
+ import { WORKFLOW } from 'src/constant/global.constant';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { Column, Entity } from 'typeorm';
4
+
5
+ @Entity({ name: 'cr_workflow' })
6
+ export class Workflow extends BaseEntity {
7
+ constructor() {
8
+ super();
9
+ this.entity_type = WORKFLOW;
10
+ }
11
+
12
+ @Column({ type: 'varchar', nullable: true })
13
+ mapped_entity_type: string;
14
+ }
@@ -0,0 +1,4 @@
1
+ import { Injectable } from '@nestjs/common';
2
+
3
+ @Injectable()
4
+ export class WorkflowRepsository {}
@@ -0,0 +1,5 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
+
4
+ @Injectable()
5
+ export class ActionCategoryService extends EntityServiceImpl {}
@@ -0,0 +1,5 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
+
4
+ @Injectable()
5
+ export class ActionTemplateMappingService extends EntityServiceImpl {}
@@ -0,0 +1,51 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
4
+ import { UserData } from 'src/module/user/entity/user.entity';
5
+ import { EntityManager } from 'typeorm';
6
+
7
+ @Injectable()
8
+ export class ActionService extends EntityServiceImpl {
9
+ constructor() {
10
+ super();
11
+ }
12
+
13
+ async createEntity(entityData: BaseEntity, loggedInUser: UserData | null, manager?: EntityManager | null, appcode?: string): Promise<any> {
14
+ console.log("entityData", entityData);
15
+
16
+ let actionData = entityData as any;
17
+
18
+ let action = await super.createEntity(entityData, loggedInUser, manager, appcode)
19
+
20
+ let stageActionMapping={
21
+ action_id: action.id,
22
+ stage_id: actionData.stage_id,
23
+ entity_type:"STGM",
24
+ } as any;
25
+
26
+ let stageActionMappingData = await super.createEntity(stageActionMapping, loggedInUser, manager, appcode);
27
+
28
+ if(actionData.template.length > 0) {
29
+
30
+ let templates=actionData.template;
31
+
32
+ for (let i = 0; i < templates.length; i++) {
33
+
34
+ //templateData = getEntityData
35
+
36
+ let actionTemplateMapping ={
37
+ stg_act_mapping_id: stageActionMappingData.id,
38
+ template_code:"",
39
+ entity_type: "ACTM",
40
+ } as any;
41
+
42
+ //creaEntity
43
+
44
+ }
45
+
46
+
47
+ }
48
+
49
+ return actionData;
50
+ }
51
+ }
@@ -0,0 +1,5 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
+
4
+ @Injectable()
5
+ export class CommTemplateService extends EntityServiceImpl {}
@@ -0,0 +1,5 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
+
4
+ @Injectable()
5
+ export class StageActionMappingService extends EntityServiceImpl {}
@@ -0,0 +1,5 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
+
4
+ @Injectable()
5
+ export class StageGroupService extends EntityServiceImpl {}
@@ -0,0 +1,5 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
+
4
+ @Injectable()
5
+ export class StageService extends EntityServiceImpl {}
@@ -0,0 +1,9 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
+
4
+ @Injectable()
5
+ export class WorkflowService extends EntityServiceImpl {
6
+ constructor() {
7
+ super();
8
+ }
9
+ }
@@ -0,0 +1,63 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { Workflow } from './entity/workflow.entity';
3
+ import { WorkflowService } from './service/workflow.service';
4
+ import { StageGroup } from './entity/stage-group.entity';
5
+ import { Stage } from './entity/stage.entity';
6
+ import { ActionCategory } from './entity/action-category.entity';
7
+ import { CommTemplate } from './entity/comm-template.entity';
8
+ import { ActionTemplateMapping } from './entity/action-template-mapping.entity';
9
+ import { StageActionMapping } from './entity/stage-action-mapping.entity';
10
+ import { ActionCategoryService } from './service/action-category.service';
11
+ import { CommTemplateService } from './service/comm-template.service';
12
+ import { StageActionMappingService } from './service/stage-action-mapping.service';
13
+ import { ActionTemplateMappingService } from './service/action-template-mapping.service';
14
+ import { ActionService } from './service/action.service';
15
+ import { StageService } from './service/stage.service';
16
+ import { StageGroupService } from './service/stage-group.service';
17
+ import { TypeOrmModule } from '@nestjs/typeorm';
18
+ import { EntityModule } from '../meta/entity.module';
19
+ import { Action } from './entity/action.entity';
20
+
21
+ @Module({
22
+ imports: [
23
+ TypeOrmModule.forFeature([
24
+ Workflow,
25
+ Action,
26
+ ActionCategory,
27
+ Stage,
28
+ StageGroup,
29
+ CommTemplate,
30
+ ActionTemplateMapping,
31
+ StageActionMapping,
32
+ ]),
33
+ EntityModule,
34
+ ],
35
+ providers: [
36
+ { provide: 'WorkflowService', useClass: WorkflowService },
37
+ { provide: 'ActionCategoryService', useClass: ActionCategoryService },
38
+ { provide: 'CommTemplateService', useClass: CommTemplateService },
39
+ {
40
+ provide: 'ActionTemplateMappingService',
41
+ useClass: ActionTemplateMappingService,
42
+ },
43
+ {
44
+ provide: 'StageActionMappingService',
45
+ useClass: StageActionMappingService,
46
+ },
47
+ { provide: 'ActionService', useClass: ActionService },
48
+ { provide: 'StageService', useClass: StageService },
49
+ { provide: 'StageGroupService', useClass: StageGroupService },
50
+ ],
51
+ exports: [
52
+ 'WorkflowService',
53
+ 'ActionCategoryService',
54
+ 'CommTemplateService',
55
+ 'ActionTemplateMappingService',
56
+ 'StageActionMappingService',
57
+ 'ActionService',
58
+ 'StageService',
59
+ 'StageGroupService',
60
+ ],
61
+ controllers: [],
62
+ })
63
+ export class WorkflowModule {}
@@ -3,7 +3,7 @@ DB_HOST: '13.234.25.234'
3
3
  DB_PORT: '3306'
4
4
  DB_USER: 'root'
5
5
  DB_PASS: 'Rezolut@123'
6
- DB_NAME: 'core'
6
+ DB_NAME: 'package_core'
7
7
  MASTER_KEY: '0QZ2eRJv5oVILYnyBlC+FbSGVQiWKReh'
8
8
  MASTER_IV: 'heuUQf5uPVtkotrFAOKUVw=='
9
9
  SECRET_KEY: '1hard_to_guess_secret7890a'