rez_core 2.2.158 → 2.2.159

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 (239) hide show
  1. package/dist/module/auth/strategies/google.strategy.js +6 -1
  2. package/dist/module/auth/strategies/google.strategy.js.map +1 -1
  3. package/dist/module/auth/strategies/jwt.strategy.js +1 -1
  4. package/dist/module/auth/strategies/jwt.strategy.js.map +1 -1
  5. package/dist/module/communication/communication.module.js +13 -2
  6. package/dist/module/communication/communication.module.js.map +1 -1
  7. package/dist/module/communication/controller/communication.controller.js.map +1 -1
  8. package/dist/module/communication/dto/create-config.dto.js +11 -1
  9. package/dist/module/communication/dto/create-config.dto.js.map +1 -1
  10. package/dist/module/communication/entity/communication-config.entity.js.map +1 -1
  11. package/dist/module/communication/entity/communication-hub.entity.js +11 -1
  12. package/dist/module/communication/entity/communication-hub.entity.js.map +1 -1
  13. package/dist/module/communication/examples/usage.example.js +9 -9
  14. package/dist/module/communication/examples/usage.example.js.map +1 -1
  15. package/dist/module/communication/factories/communication.factory.js +4 -4
  16. package/dist/module/communication/factories/communication.factory.js.map +1 -1
  17. package/dist/module/communication/factories/email.factory.js +1 -1
  18. package/dist/module/communication/factories/email.factory.js.map +1 -1
  19. package/dist/module/communication/factories/sms.factory.js +1 -1
  20. package/dist/module/communication/factories/sms.factory.js.map +1 -1
  21. package/dist/module/communication/factories/telephone.factory.js +2 -4
  22. package/dist/module/communication/factories/telephone.factory.js.map +1 -1
  23. package/dist/module/communication/factories/whatsapp.factory.js +2 -4
  24. package/dist/module/communication/factories/whatsapp.factory.js.map +1 -1
  25. package/dist/module/communication/service/communication-queue.service.d.ts +40 -0
  26. package/dist/module/communication/service/communication-queue.service.js +147 -0
  27. package/dist/module/communication/service/communication-queue.service.js.map +1 -0
  28. package/dist/module/communication/service/communication.service.d.ts +34 -2
  29. package/dist/module/communication/service/communication.service.js +117 -24
  30. package/dist/module/communication/service/communication.service.js.map +1 -1
  31. package/dist/module/communication/service/oauth.service.js +25 -20
  32. package/dist/module/communication/service/oauth.service.js.map +1 -1
  33. package/dist/module/communication/strategies/email/gmail-api.strategy.js +16 -7
  34. package/dist/module/communication/strategies/email/gmail-api.strategy.js.map +1 -1
  35. package/dist/module/communication/strategies/gmail-smtp.strategy.js +2 -3
  36. package/dist/module/communication/strategies/gmail-smtp.strategy.js.map +1 -1
  37. package/dist/module/communication/strategies/gmail.strategy.js.map +1 -1
  38. package/dist/module/communication/strategies/knowlarity.strategy.js +20 -14
  39. package/dist/module/communication/strategies/knowlarity.strategy.js.map +1 -1
  40. package/dist/module/communication/strategies/outlook-smtp.strategy.js +2 -3
  41. package/dist/module/communication/strategies/outlook-smtp.strategy.js.map +1 -1
  42. package/dist/module/communication/strategies/outlook.strategy.js +1 -1
  43. package/dist/module/communication/strategies/outlook.strategy.js.map +1 -1
  44. package/dist/module/communication/strategies/sms.strategy.js +1 -3
  45. package/dist/module/communication/strategies/sms.strategy.js.map +1 -1
  46. package/dist/module/communication/strategies/whatsapp.strategy.js +1 -2
  47. package/dist/module/communication/strategies/whatsapp.strategy.js.map +1 -1
  48. package/dist/module/dashboard/dashboard.module.js +1 -1
  49. package/dist/module/dashboard/repository/dashboard.repository.js.map +1 -1
  50. package/dist/module/dashboard/service/dashboard.service.js +3 -3
  51. package/dist/module/dashboard/service/dashboard.service.js.map +1 -1
  52. package/dist/module/enterprise/repository/organization.repository.js.map +1 -1
  53. package/dist/module/filter/entity/saved-filter-master.entity.d.ts +1 -1
  54. package/dist/module/filter/service/filter.service.js +3 -3
  55. package/dist/module/filter/service/filter.service.js.map +1 -1
  56. package/dist/module/filter/service/saved-filter.service.js.map +1 -1
  57. package/dist/module/layout/controller/layout.controller.js +1 -1
  58. package/dist/module/layout/controller/layout.controller.js.map +1 -1
  59. package/dist/module/layout/repository/header-section.repository.js.map +1 -1
  60. package/dist/module/layout/service/header-section.service.js +2 -2
  61. package/dist/module/layout/service/header-section.service.js.map +1 -1
  62. package/dist/module/layout_preference/repository/layout_preference.repository.js +1 -1
  63. package/dist/module/layout_preference/service/layout_preference.service.js +1 -1
  64. package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -1
  65. package/dist/module/listmaster/controller/list-master.controller.js +1 -1
  66. package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
  67. package/dist/module/listmaster/repository/list-master.repository.js.map +1 -1
  68. package/dist/module/listmaster/service/list-master.service.js +2 -2
  69. package/dist/module/listmaster/service/list-master.service.js.map +1 -1
  70. package/dist/module/master/controller/master.controller.js +2 -2
  71. package/dist/module/master/controller/master.controller.js.map +1 -1
  72. package/dist/module/master/service/master.service.js +1 -1
  73. package/dist/module/master/service/master.service.js.map +1 -1
  74. package/dist/module/meta/controller/attribute-master.controller.js +3 -3
  75. package/dist/module/meta/controller/attribute-master.controller.js.map +1 -1
  76. package/dist/module/meta/controller/entity-dynamic.controller.js +1 -1
  77. package/dist/module/meta/controller/entity-dynamic.controller.js.map +1 -1
  78. package/dist/module/meta/controller/entity.controller.js +2 -2
  79. package/dist/module/meta/controller/entity.controller.js.map +1 -1
  80. package/dist/module/meta/controller/media.controller.js +1 -1
  81. package/dist/module/meta/controller/media.controller.js.map +1 -1
  82. package/dist/module/meta/controller/meta.controller.js +1 -1
  83. package/dist/module/meta/controller/meta.controller.js.map +1 -1
  84. package/dist/module/meta/dto/entity-table.dto.js.map +1 -1
  85. package/dist/module/meta/entity/entity-master.entity.d.ts +1 -0
  86. package/dist/module/meta/entity/entity-master.entity.js +4 -0
  87. package/dist/module/meta/entity/entity-master.entity.js.map +1 -1
  88. package/dist/module/meta/entity/entity-table.entity.js.map +1 -1
  89. package/dist/module/meta/service/entity-dynamic.service.js +1 -1
  90. package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
  91. package/dist/module/meta/service/entity-list.service.js +11 -11
  92. package/dist/module/meta/service/entity-list.service.js.map +1 -1
  93. package/dist/module/meta/service/entity-service-impl.service.js +2 -2
  94. package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
  95. package/dist/module/meta/service/entity-table-column.service.js +3 -3
  96. package/dist/module/meta/service/entity-table-column.service.js.map +1 -1
  97. package/dist/module/meta/service/entity-table.service.js +2 -2
  98. package/dist/module/meta/service/entity-table.service.js.map +1 -1
  99. package/dist/module/meta/service/media-data.service.js +3 -3
  100. package/dist/module/meta/service/media-data.service.js.map +1 -1
  101. package/dist/module/meta/service/update-form-json.service.d.ts +3 -3
  102. package/dist/module/meta/service/update-form-json.service.js +1 -1
  103. package/dist/module/meta/service/update-form-json.service.js.map +1 -1
  104. package/dist/module/module/controller/menu.controller.js.map +1 -1
  105. package/dist/module/module/controller/module-access.controller.js +1 -1
  106. package/dist/module/module/controller/module-access.controller.js.map +1 -1
  107. package/dist/module/module/entity/module-access.entity.js.map +1 -1
  108. package/dist/module/module/entity/module.entity.js.map +1 -1
  109. package/dist/module/module/service/module-access.service.d.ts +1 -1
  110. package/dist/module/module/service/module-access.service.js +1 -1
  111. package/dist/module/module/service/module-access.service.js.map +1 -1
  112. package/dist/module/notification/controller/otp.controller.js +3 -3
  113. package/dist/module/notification/controller/otp.controller.js.map +1 -1
  114. package/dist/module/notification/service/email.service.js +2 -2
  115. package/dist/module/notification/service/email.service.js.map +1 -1
  116. package/dist/module/notification/service/otp.service.js +1 -1
  117. package/dist/module/notification/service/otp.service.js.map +1 -1
  118. package/dist/module/user/controller/login.controller.js +4 -2
  119. package/dist/module/user/controller/login.controller.js.map +1 -1
  120. package/dist/module/user/service/login.service.js +3 -3
  121. package/dist/module/user/service/login.service.js.map +1 -1
  122. package/dist/module/user/service/role.service.js +1 -1
  123. package/dist/module/user/service/role.service.js.map +1 -1
  124. package/dist/module/user/service/user.service.js +5 -5
  125. package/dist/module/user/service/user.service.js.map +1 -1
  126. package/dist/module/workflow/controller/workflow-meta.controller.js +1 -1
  127. package/dist/module/workflow/controller/workflow-meta.controller.js.map +1 -1
  128. package/dist/module/workflow/service/action.service.js +3 -3
  129. package/dist/module/workflow/service/action.service.js.map +1 -1
  130. package/dist/module/workflow/service/stage-group.service.js +1 -1
  131. package/dist/module/workflow/service/stage-group.service.js.map +1 -1
  132. package/dist/module/workflow/service/workflow-meta.service.js +5 -5
  133. package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
  134. package/dist/resources/properties.module.js +2 -2
  135. package/dist/resources/properties.module.js.map +1 -1
  136. package/dist/tsconfig.build.tsbuildinfo +1 -1
  137. package/dist/utils/service/base64util.service.js.map +1 -1
  138. package/dist/utils/service/clockIDGenUtil.service.js.map +1 -1
  139. package/dist/utils/service/dateUtil.service.js +1 -1
  140. package/dist/utils/service/dateUtil.service.js.map +1 -1
  141. package/dist/utils/service/encryptUtil.service.js +4 -4
  142. package/dist/utils/service/encryptUtil.service.js.map +1 -1
  143. package/dist/utils/service/excel-helper.service.js +4 -1
  144. package/dist/utils/service/excel-helper.service.js.map +1 -1
  145. package/dist/utils/service/json-util.service.js.map +1 -1
  146. package/dist/utils/service/loggingUtil.service.js +3 -3
  147. package/dist/utils/service/loggingUtil.service.js.map +1 -1
  148. package/package.json +1 -1
  149. package/src/decorators/roles.decorator.ts +1 -1
  150. package/src/module/auth/strategies/google.strategy.ts +6 -1
  151. package/src/module/auth/strategies/jwt.strategy.ts +1 -1
  152. package/src/module/communication/communication.module.ts +13 -2
  153. package/src/module/communication/controller/communication.controller.ts +21 -18
  154. package/src/module/communication/dto/create-config.dto.ts +32 -13
  155. package/src/module/communication/entity/communication-config.entity.ts +15 -9
  156. package/src/module/communication/entity/communication-hub.entity.ts +29 -3
  157. package/src/module/communication/examples/usage.example.ts +18 -17
  158. package/src/module/communication/factories/communication.factory.ts +36 -18
  159. package/src/module/communication/factories/email.factory.ts +8 -5
  160. package/src/module/communication/factories/sms.factory.ts +8 -5
  161. package/src/module/communication/factories/telephone.factory.ts +9 -8
  162. package/src/module/communication/factories/whatsapp.factory.ts +9 -8
  163. package/src/module/communication/service/communication-queue.service.ts +214 -0
  164. package/src/module/communication/service/communication.service.ts +340 -101
  165. package/src/module/communication/service/oauth.service.ts +67 -46
  166. package/src/module/communication/strategies/email/gmail-api.strategy.ts +44 -24
  167. package/src/module/communication/strategies/gmail-smtp.strategy.ts +15 -11
  168. package/src/module/communication/strategies/gmail.strategy.ts +15 -7
  169. package/src/module/communication/strategies/knowlarity.strategy.ts +67 -33
  170. package/src/module/communication/strategies/outlook-smtp.strategy.ts +15 -11
  171. package/src/module/communication/strategies/outlook.strategy.ts +12 -5
  172. package/src/module/communication/strategies/sms.strategy.ts +13 -10
  173. package/src/module/communication/strategies/whatsapp.strategy.ts +13 -9
  174. package/src/module/dashboard/dashboard.module.ts +1 -1
  175. package/src/module/dashboard/repository/dashboard.repository.ts +4 -2
  176. package/src/module/dashboard/service/dashboard.service.ts +16 -12
  177. package/src/module/enterprise/repository/organization.repository.ts +3 -1
  178. package/src/module/enterprise/service/enterprise.service.ts +2 -2
  179. package/src/module/filter/entity/saved-filter-master.entity.ts +3 -3
  180. package/src/module/filter/service/filter.service.ts +3 -3
  181. package/src/module/filter/service/saved-filter.service.ts +1 -1
  182. package/src/module/layout/controller/layout.controller.ts +1 -1
  183. package/src/module/layout/repository/header-section.repository.ts +2 -2
  184. package/src/module/layout/service/header-section.service.ts +2 -3
  185. package/src/module/layout_preference/repository/layout_preference.repository.ts +2 -2
  186. package/src/module/layout_preference/service/layout_preference.service.ts +1 -1
  187. package/src/module/listmaster/controller/list-master.controller.ts +1 -1
  188. package/src/module/listmaster/repository/list-master.repository.ts +2 -2
  189. package/src/module/listmaster/service/list-master.service.ts +2 -2
  190. package/src/module/master/controller/master.controller.ts +2 -2
  191. package/src/module/master/service/master.service.ts +1 -1
  192. package/src/module/meta/controller/attribute-master.controller.ts +3 -3
  193. package/src/module/meta/controller/entity-dynamic.controller.ts +1 -1
  194. package/src/module/meta/controller/entity.controller.ts +2 -2
  195. package/src/module/meta/controller/media.controller.ts +1 -1
  196. package/src/module/meta/controller/meta.controller.ts +1 -1
  197. package/src/module/meta/dto/entity-tab.dto.ts +4 -4
  198. package/src/module/meta/dto/entity-table.dto.ts +5 -6
  199. package/src/module/meta/entity/entity-master.entity.ts +3 -0
  200. package/src/module/meta/entity/entity-table.entity.ts +1 -2
  201. package/src/module/meta/service/entity-dynamic.service.ts +1 -1
  202. package/src/module/meta/service/entity-list.service.ts +18 -14
  203. package/src/module/meta/service/entity-service-impl.service.ts +2 -2
  204. package/src/module/meta/service/entity-table-column.service.ts +3 -3
  205. package/src/module/meta/service/entity-table.service.ts +2 -2
  206. package/src/module/meta/service/entity.service.ts +1 -1
  207. package/src/module/meta/service/media-data.service.ts +3 -3
  208. package/src/module/meta/service/update-form-json.service.ts +17 -26
  209. package/src/module/module/controller/menu.controller.ts +0 -1
  210. package/src/module/module/controller/module-access.controller.ts +2 -3
  211. package/src/module/module/entity/menu.entity.ts +1 -1
  212. package/src/module/module/entity/module-access.entity.ts +6 -6
  213. package/src/module/module/entity/module-action.entity.ts +2 -2
  214. package/src/module/module/entity/module.entity.ts +0 -1
  215. package/src/module/module/service/module-access.service.ts +7 -8
  216. package/src/module/notification/controller/otp.controller.ts +10 -4
  217. package/src/module/notification/repository/otp.repository.ts +1 -1
  218. package/src/module/notification/service/email.service.ts +2 -2
  219. package/src/module/notification/service/otp.service.ts +8 -3
  220. package/src/module/third-party-module/third-party.module.ts +1 -1
  221. package/src/module/user/controller/login.controller.ts +27 -12
  222. package/src/module/user/service/login.service.ts +27 -27
  223. package/src/module/user/service/role.service.ts +1 -1
  224. package/src/module/user/service/user.service.ts +5 -5
  225. package/src/module/workflow/controller/workflow-meta.controller.ts +1 -1
  226. package/src/module/workflow/service/action.service.ts +3 -3
  227. package/src/module/workflow/service/stage-group.service.ts +1 -1
  228. package/src/module/workflow/service/workflow-meta.service.ts +5 -5
  229. package/src/resources/properties.module.ts +10 -10
  230. package/src/utils/dto/excel-data.dto.ts +2 -2
  231. package/src/utils/dto/excelsheet-data.dto.ts +3 -3
  232. package/src/utils/service/base64util.service.ts +16 -17
  233. package/src/utils/service/clockIDGenUtil.service.ts +15 -13
  234. package/src/utils/service/dateUtil.service.ts +6 -6
  235. package/src/utils/service/encryptUtil.service.ts +4 -4
  236. package/src/utils/service/excel-helper.service.ts +4 -1
  237. package/src/utils/service/file-util.service.ts +2 -2
  238. package/src/utils/service/json-util.service.ts +19 -19
  239. package/src/utils/service/loggingUtil.service.ts +4 -4
@@ -82,14 +82,14 @@ export class EntityTableService {
82
82
  loggedInUser: any,
83
83
  ) {
84
84
  console.log(entityType, listType, displayType, loggedInUser);
85
- let entityTable = await this.findByEntityTypeAndListTypeAndDisplayType(
85
+ const entityTable = await this.findByEntityTypeAndListTypeAndDisplayType(
86
86
  entityType,
87
87
  listType,
88
88
  displayType,
89
89
  loggedInUser?.organization_id,
90
90
  );
91
91
  console.log(entityTable, 'entityTable');
92
- let entityTableDto = entityTable as EntityTableDto;
92
+ const entityTableDto = entityTable as EntityTableDto;
93
93
  if (entityTable) {
94
94
  entityTableDto.column_list =
95
95
  await this.entityTableColumnRepository.findByParentIdAndParentType(
@@ -15,7 +15,7 @@ export interface EntityService<T extends BaseEntity> {
15
15
  entityId: number,
16
16
  loggedInUser: UserData,
17
17
  ): Promise<BaseEntity | null>;
18
-
18
+
19
19
  getResolvedEntityData(
20
20
  entityType: string,
21
21
  entityId: number,
@@ -53,7 +53,7 @@ export class MediaDataService extends EntityServiceImpl {
53
53
  ContentType: this.getContentType(ext),
54
54
  });
55
55
 
56
- let mediaData = new MediaData();
56
+ const mediaData = new MediaData();
57
57
  mediaData.file_name = fileName;
58
58
  mediaData.mapped_attribute_key = mappedAttributeKey;
59
59
  mediaData.status = STATUS_PENDING;
@@ -65,7 +65,7 @@ export class MediaDataService extends EntityServiceImpl {
65
65
  }
66
66
  mediaData.media_url = s3Key;
67
67
 
68
- let savedEntity = await super.createEntity(mediaData, loggedInUser);
68
+ const savedEntity = await super.createEntity(mediaData, loggedInUser);
69
69
 
70
70
  if (savedEntity) {
71
71
  return { id: savedEntity.id, path: s3Key, uploadUrl };
@@ -125,7 +125,7 @@ export class MediaDataService extends EntityServiceImpl {
125
125
  id,
126
126
  loggedInUser,
127
127
  );
128
- let mediaData = entityData as MediaData;
128
+ const mediaData = entityData as MediaData;
129
129
  const signedUrl = await this.s3.getSignedUrlPromise('getObject', {
130
130
  Bucket: this.bucketName,
131
131
  Key: mediaData.media_url,
@@ -1,31 +1,22 @@
1
- import { Injectable } from "@nestjs/common";
2
- import { InjectRepository } from "@nestjs/typeorm";
3
- import { ViewMaster } from "../entity/view-master.entity";
4
- import { Repository } from "typeorm";
5
- import { ClockIDGenService } from "src/utils/service/clockIDGenUtil.service";
6
-
7
-
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectRepository } from '@nestjs/typeorm';
3
+ import { ViewMaster } from '../entity/view-master.entity';
4
+ import { Repository } from 'typeorm';
5
+ import { ClockIDGenService } from 'src/utils/service/clockIDGenUtil.service';
8
6
 
9
7
  @Injectable()
10
- export class UpdateFormJsonService {
11
- constructor(
12
- @InjectRepository(ViewMaster)
13
- private readonly viewMasterRepository: Repository<ViewMaster>,
14
- private readonly clockIDGenService: ClockIDGenService,
15
-
16
- ) {}
17
-
18
- async updateFormJson(body:any): Promise<ViewMaster> {
19
-
20
- const entityType = this.clockIDGenService.idGenerator();
21
-
22
- const newViewMasterRecord = ({})
23
-
24
-
25
- return this.viewMasterRepository.save(newViewMasterRecord)
26
- }
27
-
8
+ export class UpdateFormJsonService {
9
+ constructor(
10
+ @InjectRepository(ViewMaster)
11
+ private readonly viewMasterRepository: Repository<ViewMaster>,
12
+ private readonly clockIDGenService: ClockIDGenService,
13
+ ) {}
28
14
 
15
+ async updateFormJson(body: any): Promise<ViewMaster> {
16
+ const entityType = this.clockIDGenService.idGenerator();
29
17
 
18
+ const newViewMasterRecord = {};
30
19
 
31
- }
20
+ return this.viewMasterRepository.save(newViewMasterRecord);
21
+ }
22
+ }
@@ -12,5 +12,4 @@ export class MenuController {
12
12
  const { id: userId, appcode, level_type, level_id } = req.user.userData;
13
13
  return this.menuService.getUserMenu(userId, appcode, level_type, level_id);
14
14
  }
15
-
16
15
  }
@@ -23,12 +23,11 @@ export class ModuleAccessController {
23
23
  private readonly menuService: MenuService,
24
24
  ) {}
25
25
 
26
-
27
26
  @Get('roles')
28
27
  async getRoles(
29
28
  @Query('appcode') appcode: string,
30
29
  @Query('include') include: string, // ✅ declare it as boolean
31
- @Request() req
30
+ @Request() req,
32
31
  ) {
33
32
  const { level_type, level_id, organization_id } = req.user.userData;
34
33
 
@@ -37,7 +36,7 @@ export class ModuleAccessController {
37
36
  level_type,
38
37
  level_id,
39
38
  organization_id,
40
- include: include === "true", // ensure it's either true or false
39
+ include: include === 'true', // ensure it's either true or false
41
40
  });
42
41
  }
43
42
 
@@ -37,7 +37,7 @@ export class MenuData {
37
37
 
38
38
  @Column({ type: 'varchar', nullable: true })
39
39
  appcode: string;
40
-
40
+
41
41
  @Column({ type: 'varchar', nullable: true })
42
42
  level_type: string;
43
43
  }
@@ -5,21 +5,21 @@ export class ModuleAccess {
5
5
  @PrimaryGeneratedColumn()
6
6
  id: number;
7
7
 
8
- @Column({type: 'varchar', length: 100, nullable: true})
8
+ @Column({ type: 'varchar', length: 100, nullable: true })
9
9
  module_code: string;
10
10
 
11
- @Column({type: 'varchar', length: 100, nullable: true })
11
+ @Column({ type: 'varchar', length: 100, nullable: true })
12
12
  role_code: string;
13
13
 
14
- @Column({type: 'int', nullable: true })
14
+ @Column({ type: 'int', nullable: true })
15
15
  access_flag: number;
16
16
 
17
- @Column({type: 'varchar', length: 100, nullable: true })
17
+ @Column({ type: 'varchar', length: 100, nullable: true })
18
18
  action_type: string;
19
19
 
20
- @Column({type: 'varchar', length: 100, nullable: true })
20
+ @Column({ type: 'varchar', length: 100, nullable: true })
21
21
  level_type: string;
22
22
 
23
- @Column({type: 'varchar', length: 100, nullable: true})
23
+ @Column({ type: 'varchar', length: 100, nullable: true })
24
24
  appcode: string;
25
25
  }
@@ -1,7 +1,7 @@
1
1
  import { Column, Entity, PrimaryGeneratedColumn, Unique } from 'typeorm';
2
2
 
3
- @Entity({ name: 'cr_module_action' }) // <- new table name
4
- @Unique(['module_code', 'action_type']) // enforce uniqueness per module + action
3
+ @Entity({ name: 'cr_module_action' }) // <- new table name
4
+ @Unique(['module_code', 'action_type']) // enforce uniqueness per module + action
5
5
  export class ModuleAction {
6
6
  @PrimaryGeneratedColumn()
7
7
  id: number;
@@ -32,7 +32,6 @@ export class ModuleData {
32
32
  @Column({ type: 'varchar', length: 100, nullable: true })
33
33
  entity_type: string;
34
34
 
35
-
36
35
  @Column({ type: 'varchar', length: 100, nullable: true })
37
36
  title: string;
38
37
 
@@ -33,7 +33,7 @@ export class ModuleAccessService {
33
33
  level_type,
34
34
  level_id,
35
35
  organization_id,
36
- include
36
+ include,
37
37
  }: {
38
38
  appcode: string;
39
39
  level_type?: string;
@@ -46,36 +46,35 @@ export class ModuleAccessService {
46
46
  .select('*')
47
47
  .from('cr_role', 'role')
48
48
  .where('role.appcode = :appcode', { appcode });
49
-
49
+
50
50
  // Only add this condition if `include` is false (exclude factory roles)
51
51
  if (!include) {
52
52
  query.andWhere('(role.is_factory IS NULL OR role.is_factory != 1)');
53
53
  }
54
-
54
+
55
55
  if (level_type) {
56
56
  query.andWhere('role.level_type = :level_type', { level_type });
57
57
  }
58
-
58
+
59
59
  if (organization_id) {
60
60
  query.andWhere('role.organization_id = :organization_id', {
61
61
  organization_id,
62
62
  });
63
63
  }
64
-
64
+
65
65
  if (level_id !== undefined) {
66
66
  query.andWhere('role.level_id = :level_id', {
67
67
  level_id: String(level_id),
68
68
  });
69
69
  }
70
-
70
+
71
71
  const roles = await query.getRawMany();
72
-
72
+
73
73
  return roles.map((role) => ({
74
74
  label: role.name,
75
75
  value: role.id,
76
76
  }));
77
77
  }
78
-
79
78
 
80
79
  async getAccessListing(
81
80
  roleIds: number[],
@@ -26,13 +26,13 @@ export class OtpController {
26
26
  @Post('generate')
27
27
  @HttpCode(HttpStatus.OK)
28
28
  async generateOtp(@Body() request: any) {
29
- let identifier = request.identifier;
30
- let service = request.service;
29
+ const identifier = request.identifier;
30
+ const service = request.service;
31
31
 
32
32
  if (!identifier || !service) {
33
33
  throw new BadRequestException('Missing identifier or service!');
34
34
  }
35
- let otp = await this.otpService.generate(
35
+ const otp = await this.otpService.generate(
36
36
  identifier,
37
37
  service,
38
38
  parseInt(this.otpExpiry),
@@ -44,7 +44,13 @@ export class OtpController {
44
44
  @Post('verify')
45
45
  @HttpCode(HttpStatus.OK)
46
46
  async verifyOtp(
47
- @Body() body: { otp: string; otp_id: string; identifier: string, subdomain: string },
47
+ @Body()
48
+ body: {
49
+ otp: string;
50
+ otp_id: string;
51
+ identifier: string;
52
+ subdomain: string;
53
+ },
48
54
  ) {
49
55
  return await this.otpService.verifyOtp(body);
50
56
  }
@@ -21,7 +21,7 @@ export class OtpRepository {
21
21
  });
22
22
  }
23
23
 
24
- async update(id: number, otp: Otp){
24
+ async update(id: number, otp: Otp) {
25
25
  return await this.otpRepository.update(id, otp);
26
26
  }
27
27
  }
@@ -27,7 +27,7 @@ export class EmailService {
27
27
  const compiled = Handlebars.compile(template.rich_text || '');
28
28
  const htmlContent = compiled(context);
29
29
 
30
- let attachments: any[] = [];
30
+ const attachments: any[] = [];
31
31
 
32
32
  if (icsPayload) {
33
33
  const icsBase64 = await this.icsService.generateIcs(icsPayload);
@@ -96,7 +96,7 @@ export class EmailService {
96
96
  }
97
97
  const htmlContent = compiled(context);
98
98
 
99
- let attachments: any[] = [];
99
+ const attachments: any[] = [];
100
100
 
101
101
  if (icsPayload) {
102
102
  const icsBase64 = await this.icsService.generateIcs(icsPayload);
@@ -27,7 +27,7 @@ export class OtpService {
27
27
  expiresIn: number = 5,
28
28
  otpLength: number = 6,
29
29
  ) {
30
- let otp = new Otp();
30
+ const otp = new Otp();
31
31
  otp.created_date = new Date();
32
32
  otp.otp_id = this.idGen.idGenerator();
33
33
  otp.identifier = identifier;
@@ -53,8 +53,13 @@ export class OtpService {
53
53
  return await this.otpRepository.save(otp);
54
54
  }
55
55
 
56
- async verifyOtp(body: { otp: string; otp_id: string; identifier: string; subdomain: string }) {
57
- const { otp, otp_id, identifier ,subdomain} = body;
56
+ async verifyOtp(body: {
57
+ otp: string;
58
+ otp_id: string;
59
+ identifier: string;
60
+ subdomain: string;
61
+ }) {
62
+ const { otp, otp_id, identifier, subdomain } = body;
58
63
  const verifyOTPResponse = { isValid: false };
59
64
 
60
65
  // Find OTP entity by ID
@@ -9,4 +9,4 @@ import { ApiRegistryService } from './service/api-registry.service';
9
9
  providers: [ThirdPartyApiRegistryRepository, ApiRegistryService],
10
10
  exports: [ApiRegistryService],
11
11
  })
12
- export class ThirdPartyModule {}
12
+ export class ThirdPartyModule {}
@@ -28,8 +28,13 @@ export class LoginController {
28
28
 
29
29
  @Post('login')
30
30
  async login(@Body() body, @Res() res: Response) {
31
- const { email_id, password, appcode, organization_id ,subdomain} = body;
32
- const result = await this.loginService.login(email_id, password,false,subdomain);
31
+ const { email_id, password, appcode, organization_id, subdomain } = body;
32
+ const result = await this.loginService.login(
33
+ email_id,
34
+ password,
35
+ false,
36
+ subdomain,
37
+ );
33
38
  return res.status(HttpStatus.OK).json(result);
34
39
  }
35
40
  @Post('form-login')
@@ -60,23 +65,33 @@ export class LoginController {
60
65
  @Get('google/callback')
61
66
  @UseGuards(GoogleAuthGuard)
62
67
  async googleAuthRedirect(@Req() req: any, @Res() res: Response) {
63
- const { email, name, accessToken: googleAccessToken, refreshToken: googleRefreshToken } = req.user;
68
+ const {
69
+ email,
70
+ name,
71
+ accessToken: googleAccessToken,
72
+ refreshToken: googleRefreshToken,
73
+ } = req.user;
64
74
  const { state } = req.query;
65
75
 
66
76
  // Check if this is a Gmail configuration request
67
- if (state && typeof state === 'string' && state.startsWith('gmail_config:')) {
77
+ if (
78
+ state &&
79
+ typeof state === 'string' &&
80
+ state.startsWith('gmail_config:')
81
+ ) {
68
82
  try {
69
83
  // Extract the actual state from the prefixed state
70
84
  const actualState = state.replace('gmail_config:', '');
71
-
85
+
72
86
  // Forward to communication service for Gmail config handling using already exchanged tokens
73
- const result = await this.communicationService.handleGmailTokensCallback(
74
- email,
75
- googleAccessToken,
76
- googleRefreshToken,
77
- actualState
78
- );
79
-
87
+ const result =
88
+ await this.communicationService.handleGmailTokensCallback(
89
+ email,
90
+ googleAccessToken,
91
+ googleRefreshToken,
92
+ actualState,
93
+ );
94
+
80
95
  return res.status(200).json({
81
96
  success: true,
82
97
  message: 'Gmail configuration saved successfully',
@@ -43,42 +43,43 @@ export class LoginService {
43
43
  subdomain?: string,
44
44
  ) {
45
45
  let organization;
46
-
46
+
47
47
  // 🔹 Step 1: If subdomain is provided, resolve the organization
48
48
  if (subdomain) {
49
49
  organization =
50
- await this.organizationRepository.findOrganizationBySubdomain(subdomain);
51
-
50
+ await this.organizationRepository.findOrganizationBySubdomain(
51
+ subdomain,
52
+ );
53
+
52
54
  if (!organization) {
53
55
  throw new BadRequestException('Organization not found.');
54
-
55
56
  }
56
57
  }
57
-
58
+
58
59
  // 🔹 Step 2: Find the user by email + organization check
59
60
  const user = await this.userService.findByEmailId(email);
60
-
61
+
61
62
  if (!user || (organization && user.organization_id !== organization.id)) {
62
- throw new BadRequestException('User not found in organization.');
63
+ throw new BadRequestException('User not found in organization.');
63
64
  }
64
-
65
+
65
66
  // 🔹 Step 3: Verify org status
66
67
  const userOrgData = await this.organizationRepository.findOrganizationById(
67
68
  user.organization_id,
68
69
  );
69
-
70
+
70
71
  const resolveStatus = await this.listMasterService.getResolvedListCode(
71
72
  STATUS_ACTIVE,
72
73
  user?.organization_id || 0,
73
74
  );
74
-
75
+
75
76
  if (
76
77
  user.status != resolveStatus.id ||
77
78
  userOrgData?.status != resolveStatus.id
78
79
  ) {
79
- throw new BadRequestException('User is inactive.');
80
+ throw new BadRequestException('User is inactive.');
80
81
  }
81
-
82
+
82
83
  // 🔹 Step 4: Verify password if not OTP
83
84
  if (!is_otp) {
84
85
  const encryptedPassword = EncryptUtilService.encryptGCM(
@@ -86,7 +87,7 @@ export class LoginService {
86
87
  this.masterKey,
87
88
  this.masterIv,
88
89
  );
89
-
90
+
90
91
  if (encryptedPassword !== user.password) {
91
92
  return {
92
93
  success: false,
@@ -95,54 +96,54 @@ export class LoginService {
95
96
  };
96
97
  }
97
98
  }
98
-
99
+
99
100
  // 🔹 Step 5: App access check
100
- let appcode = user.last_app_access;
101
-
101
+ const appcode = user.last_app_access;
102
+
102
103
  if (!user.last_app_access) {
103
104
  await this.userService.setDefaultLastAccess(user.id, appcode);
104
105
  }
105
-
106
+
106
107
  const roleMappings = await this.userRoleMappingRepository.find({
107
108
  where: { user_id: user.id, appcode },
108
109
  });
109
-
110
+
110
111
  if (!roleMappings.length) {
111
112
  throw new BadRequestException(
112
113
  'User does not have any access mapped for this app.',
113
114
  );
114
115
  }
115
-
116
+
116
117
  // 🔹 Step 6: Resolve default access
117
118
  const defaultAccess = await this.getDefaultAccess(user, roleMappings);
118
-
119
+
119
120
  await this.userService.setLastLevelTypeAndId(
120
121
  user.id,
121
122
  defaultAccess.level_type,
122
123
  defaultAccess.level_id,
123
124
  defaultAccess.appcode,
124
125
  );
125
-
126
+
126
127
  const token = await this.userSessionService.createSession(
127
128
  user,
128
129
  defaultAccess.appcode,
129
130
  defaultAccess,
130
131
  );
131
-
132
+
132
133
  // 🔹 Step 7: Update first login + invitation status
133
134
  const resolvedInvitationStatus =
134
135
  await this.listMasterService.getResolvedListCode(
135
136
  INVITATION_STATUS_ACCEPTED,
136
137
  user?.organization_id || 0,
137
138
  );
138
-
139
+
139
140
  if (user.is_firstlogin === 1) {
140
141
  user.invitation_status = resolvedInvitationStatus.id;
141
142
  user.is_firstlogin = 0;
142
143
  const { password, ...userWithoutPassword } = user;
143
144
  await this.userService.updateEntity(userWithoutPassword, user);
144
145
  }
145
-
146
+
146
147
  // 🔹 Step 8: Return response
147
148
  return {
148
149
  success: true,
@@ -152,7 +153,6 @@ export class LoginService {
152
153
  level_id: defaultAccess.level_id,
153
154
  };
154
155
  }
155
-
156
156
 
157
157
  async formLogin(body: any): Promise<any> {
158
158
  if (body) {
@@ -246,7 +246,7 @@ export class LoginService {
246
246
  }
247
247
 
248
248
  async loginWithGoogle(email: string, name) {
249
- let user = await this.userService.findByEmailId(email);
249
+ const user = await this.userService.findByEmailId(email);
250
250
 
251
251
  if (!user) {
252
252
  return new BadRequestException('User not found');
@@ -273,7 +273,7 @@ export class LoginService {
273
273
  }
274
274
 
275
275
  async logout(sessionKey: string) {
276
- let userSession =
276
+ const userSession =
277
277
  await this.userSessionService.findBySessionKey(sessionKey);
278
278
  if (userSession) {
279
279
  userSession.is_session_loggedout = 1;
@@ -28,7 +28,7 @@ export class RoleService extends EntityServiceImpl {
28
28
  entityData: BaseEntity,
29
29
  loggedInUser: UserData,
30
30
  ): Promise<ServiceResult<BaseEntity>> {
31
- let role = entityData as Role;
31
+ const role = entityData as Role;
32
32
 
33
33
  // if level_type and level_id are not provided, use loggedInUser's values
34
34
  role.level_type = entityData.level_type || loggedInUser.level_type;
@@ -49,7 +49,7 @@ export class UserService extends EntityServiceImpl {
49
49
  loggedInUser: UserData | null,
50
50
  manager?: EntityManager,
51
51
  ): Promise<ServiceResult<BaseEntity>> {
52
- let userData = entityData as CreateUserDto;
52
+ const userData = entityData as CreateUserDto;
53
53
 
54
54
  let existingUser = await this.userRepository.findByEmailId(
55
55
  userData.email_id,
@@ -139,12 +139,12 @@ export class UserService extends EntityServiceImpl {
139
139
  ): Promise<BaseEntity | null> {
140
140
  const user = await this.userRepository.findById(id);
141
141
  if (user) {
142
- let userRoleMappings: UserRoleMapping[] | null =
142
+ const userRoleMappings: UserRoleMapping[] | null =
143
143
  await this.userRoleMappingService.findByUserId(id);
144
144
  if (userRoleMappings) {
145
- let userDto = user as unknown as CreateUserDto;
146
- let roles: any[] = [];
147
- for (let i in userRoleMappings) {
145
+ const userDto = user as unknown as CreateUserDto;
146
+ const roles: any[] = [];
147
+ for (const i in userRoleMappings) {
148
148
  const userRoleMapping = userRoleMappings[i];
149
149
  const roleId = userRoleMapping.role_id;
150
150
  const role = await super.getEntityData(
@@ -25,7 +25,7 @@ export class WorkflowMetaController {
25
25
  @Query('entityId') mapped_entity_id: number,
26
26
  @Req() req: Request & { user: any },
27
27
  ): Promise<StageMovementData | null> {
28
- let loggedInUser = req.user.userData;
28
+ const loggedInUser = req.user.userData;
29
29
 
30
30
  return this.workflowMetaService.getCurrentStage(
31
31
  mapped_entity_type,
@@ -133,7 +133,7 @@ export class ActionService extends EntityServiceImpl {
133
133
  };
134
134
 
135
135
  // Pass only actionData (without template) to super.updateEntity
136
- let action = await super.updateEntity({ ...actionData }, loggedInUser);
136
+ const action = await super.updateEntity({ ...actionData }, loggedInUser);
137
137
 
138
138
  if (!action) {
139
139
  throw new Error('Action not found or could not be updated');
@@ -145,14 +145,14 @@ export class ActionService extends EntityServiceImpl {
145
145
  );
146
146
 
147
147
  // stage mapping
148
- let stageActionMapping = {
148
+ const stageActionMapping = {
149
149
  action_id: action.id,
150
150
  stage_id: stage_id,
151
151
  entity_type: 'WFSA',
152
152
  id: stageMapID.length > 0 ? stageMapID[0].id : null,
153
153
  } as any;
154
154
 
155
- let stageActionMappingData = await super.updateEntity(
155
+ const stageActionMappingData = await super.updateEntity(
156
156
  stageActionMapping,
157
157
  loggedInUser,
158
158
  );
@@ -216,7 +216,7 @@ export class StageGroupService extends EntityServiceImpl {
216
216
 
217
217
  if (user.length === 0) return null;
218
218
 
219
- let profileImageId = user[0].profile_image;
219
+ const profileImageId = user[0].profile_image;
220
220
  let profile: any = null;
221
221
 
222
222
  if (profileImageId) {