rez_core 2.2.7 → 2.2.9

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 (216) hide show
  1. package/dist/constant/global.constant.d.ts +2 -1
  2. package/dist/constant/global.constant.js +3 -2
  3. package/dist/constant/global.constant.js.map +1 -1
  4. package/dist/module/enterprise/repository/school.repository.js +18 -2
  5. package/dist/module/enterprise/repository/school.repository.js.map +1 -1
  6. package/dist/module/filter/controller/filter.controller.d.ts +1 -1
  7. package/dist/module/filter/controller/filter.controller.js +7 -4
  8. package/dist/module/filter/controller/filter.controller.js.map +1 -1
  9. package/dist/module/filter/dto/filter-request.dto.d.ts +1 -0
  10. package/dist/module/filter/service/filter.service.js +26 -4
  11. package/dist/module/filter/service/filter.service.js.map +1 -1
  12. package/dist/module/layout_preference/controller/layout_preference.controller.js +4 -4
  13. package/dist/module/layout_preference/controller/layout_preference.controller.js.map +1 -1
  14. package/dist/module/layout_preference/entity/layout_preference.entity.d.ts +2 -0
  15. package/dist/module/layout_preference/entity/layout_preference.entity.js +13 -0
  16. package/dist/module/layout_preference/entity/layout_preference.entity.js.map +1 -1
  17. package/dist/module/layout_preference/repository/layout_preference.repository.d.ts +1 -1
  18. package/dist/module/layout_preference/repository/layout_preference.repository.js +4 -2
  19. package/dist/module/layout_preference/repository/layout_preference.repository.js.map +1 -1
  20. package/dist/module/layout_preference/service/layout_preference.service.d.ts +1 -1
  21. package/dist/module/layout_preference/service/layout_preference.service.js +17 -4
  22. package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -1
  23. package/dist/module/listmaster/entity/list-master-items.entity.js +5 -5
  24. package/dist/module/listmaster/entity/list-master-items.entity.js.map +1 -1
  25. package/dist/module/meta/controller/media.controller.d.ts +1 -1
  26. package/dist/module/meta/controller/media.controller.js +1 -1
  27. package/dist/module/meta/controller/media.controller.js.map +1 -1
  28. package/dist/module/meta/entity/base-entity.entity.js.map +1 -1
  29. package/dist/module/module/controller/module-access.controller.d.ts +1 -1
  30. package/dist/module/module/controller/module-access.controller.js +6 -6
  31. package/dist/module/module/controller/module-access.controller.js.map +1 -1
  32. package/dist/module/module/service/module-access.service.d.ts +2 -1
  33. package/dist/module/module/service/module-access.service.js +5 -3
  34. package/dist/module/module/service/module-access.service.js.map +1 -1
  35. package/dist/module/workflow/controller/action-category.controller.d.ts +8 -0
  36. package/dist/module/workflow/controller/action-category.controller.js +45 -0
  37. package/dist/module/workflow/controller/action-category.controller.js.map +1 -0
  38. package/dist/module/workflow/controller/action.controller.d.ts +28 -0
  39. package/dist/module/workflow/controller/action.controller.js +88 -0
  40. package/dist/module/workflow/controller/action.controller.js.map +1 -0
  41. package/dist/module/workflow/controller/comm-template.controller.d.ts +11 -0
  42. package/dist/module/workflow/controller/comm-template.controller.js +44 -0
  43. package/dist/module/workflow/controller/comm-template.controller.js.map +1 -0
  44. package/dist/module/workflow/controller/entity-modification.controller.d.ts +8 -0
  45. package/dist/module/workflow/controller/entity-modification.controller.js +44 -0
  46. package/dist/module/workflow/controller/entity-modification.controller.js.map +1 -0
  47. package/dist/module/workflow/controller/stage-group.controller.d.ts +10 -0
  48. package/dist/module/workflow/controller/stage-group.controller.js +43 -0
  49. package/dist/module/workflow/controller/stage-group.controller.js.map +1 -0
  50. package/dist/module/workflow/controller/stage.controller.d.ts +13 -0
  51. package/dist/module/workflow/controller/stage.controller.js +56 -0
  52. package/dist/module/workflow/controller/stage.controller.js.map +1 -0
  53. package/dist/module/workflow/controller/task.controller.d.ts +21 -0
  54. package/dist/module/workflow/controller/task.controller.js +58 -0
  55. package/dist/module/workflow/controller/task.controller.js.map +1 -0
  56. package/dist/module/workflow/controller/workflow-meta.controller.d.ts +15 -0
  57. package/dist/module/workflow/controller/workflow-meta.controller.js +70 -0
  58. package/dist/module/workflow/controller/workflow-meta.controller.js.map +1 -0
  59. package/dist/module/workflow/controller/workflow.controller.d.ts +25 -10
  60. package/dist/module/workflow/controller/workflow.controller.js +32 -15
  61. package/dist/module/workflow/controller/workflow.controller.js.map +1 -1
  62. package/dist/module/workflow/entity/action-category.entity.d.ts +1 -0
  63. package/dist/module/workflow/entity/action-category.entity.js +4 -0
  64. package/dist/module/workflow/entity/action-category.entity.js.map +1 -1
  65. package/dist/module/workflow/entity/action-data.entity.d.ts +15 -0
  66. package/dist/module/workflow/entity/action-data.entity.js +70 -0
  67. package/dist/module/workflow/entity/action-data.entity.js.map +1 -0
  68. package/dist/module/workflow/entity/action.entity.d.ts +7 -2
  69. package/dist/module/workflow/entity/action.entity.js +30 -10
  70. package/dist/module/workflow/entity/action.entity.js.map +1 -1
  71. package/dist/module/workflow/entity/comm-template.entity.d.ts +5 -0
  72. package/dist/module/workflow/entity/comm-template.entity.js +21 -1
  73. package/dist/module/workflow/entity/comm-template.entity.js.map +1 -1
  74. package/dist/module/workflow/entity/entity-modification.entity.d.ts +13 -0
  75. package/dist/module/workflow/entity/entity-modification.entity.js +63 -0
  76. package/dist/module/workflow/entity/entity-modification.entity.js.map +1 -0
  77. package/dist/module/workflow/entity/stage-group.entity.d.ts +1 -1
  78. package/dist/module/workflow/entity/stage-group.entity.js +1 -1
  79. package/dist/module/workflow/entity/stage-group.entity.js.map +1 -1
  80. package/dist/module/workflow/entity/stage-movement-data.entity.d.ts +4 -0
  81. package/dist/module/workflow/entity/stage-movement-data.entity.js +16 -0
  82. package/dist/module/workflow/entity/stage-movement-data.entity.js.map +1 -1
  83. package/dist/module/workflow/entity/stage.entity.d.ts +2 -2
  84. package/dist/module/workflow/entity/stage.entity.js +5 -5
  85. package/dist/module/workflow/entity/stage.entity.js.map +1 -1
  86. package/dist/module/workflow/entity/task-data.entity.d.ts +25 -0
  87. package/dist/module/workflow/entity/task-data.entity.js +110 -0
  88. package/dist/module/workflow/entity/task-data.entity.js.map +1 -0
  89. package/dist/module/workflow/entity/template-attach-mapper.entity.d.ts +11 -0
  90. package/dist/module/workflow/entity/template-attach-mapper.entity.js +54 -0
  91. package/dist/module/workflow/entity/template-attach-mapper.entity.js.map +1 -0
  92. package/dist/module/workflow/entity/workflow-level-mapping.entity.d.ts +7 -0
  93. package/dist/module/workflow/entity/workflow-level-mapping.entity.js +38 -0
  94. package/dist/module/workflow/entity/workflow-level-mapping.entity.js.map +1 -0
  95. package/dist/module/workflow/entity/workflow.entity.d.ts +2 -0
  96. package/dist/module/workflow/entity/workflow.entity.js +8 -0
  97. package/dist/module/workflow/entity/workflow.entity.js.map +1 -1
  98. package/dist/module/workflow/repository/action-data.repository.d.ts +10 -0
  99. package/dist/module/workflow/repository/action-data.repository.js +85 -0
  100. package/dist/module/workflow/repository/action-data.repository.js.map +1 -0
  101. package/dist/module/workflow/repository/action.repository.d.ts +17 -0
  102. package/dist/module/workflow/repository/action.repository.js +97 -0
  103. package/dist/module/workflow/repository/action.repository.js.map +1 -0
  104. package/dist/module/workflow/repository/comm-template.repository.d.ts +14 -0
  105. package/dist/module/workflow/repository/comm-template.repository.js +87 -0
  106. package/dist/module/workflow/repository/comm-template.repository.js.map +1 -0
  107. package/dist/module/workflow/repository/stage-group.repository.d.ts +7 -0
  108. package/dist/module/workflow/repository/stage-group.repository.js +50 -0
  109. package/dist/module/workflow/repository/stage-group.repository.js.map +1 -0
  110. package/dist/module/workflow/repository/stage-movement.repository.d.ts +23 -0
  111. package/dist/module/workflow/repository/stage-movement.repository.js +142 -0
  112. package/dist/module/workflow/repository/stage-movement.repository.js.map +1 -0
  113. package/dist/module/workflow/repository/stage.repository.d.ts +7 -0
  114. package/dist/module/workflow/repository/stage.repository.js +50 -0
  115. package/dist/module/workflow/repository/stage.repository.js.map +1 -0
  116. package/dist/module/workflow/repository/task.repository.d.ts +10 -0
  117. package/dist/module/workflow/repository/task.repository.js +77 -0
  118. package/dist/module/workflow/repository/task.repository.js.map +1 -0
  119. package/dist/module/workflow/repository/workflow.repository.d.ts +9 -1
  120. package/dist/module/workflow/repository/workflow.repository.js +38 -6
  121. package/dist/module/workflow/repository/workflow.repository.js.map +1 -1
  122. package/dist/module/workflow/service/action-category.service.d.ts +5 -0
  123. package/dist/module/workflow/service/action-category.service.js +23 -1
  124. package/dist/module/workflow/service/action-category.service.js.map +1 -1
  125. package/dist/module/workflow/service/action-data.service.d.ts +11 -0
  126. package/dist/module/workflow/service/action-data.service.js +36 -0
  127. package/dist/module/workflow/service/action-data.service.js.map +1 -0
  128. package/dist/module/workflow/service/action.service.d.ts +19 -1
  129. package/dist/module/workflow/service/action.service.js +159 -10
  130. package/dist/module/workflow/service/action.service.js.map +1 -1
  131. package/dist/module/workflow/service/comm-template.service.d.ts +11 -0
  132. package/dist/module/workflow/service/comm-template.service.js +59 -1
  133. package/dist/module/workflow/service/comm-template.service.js.map +1 -1
  134. package/dist/module/workflow/service/entity-modification.service.d.ts +8 -0
  135. package/dist/module/workflow/service/entity-modification.service.js +52 -0
  136. package/dist/module/workflow/service/entity-modification.service.js.map +1 -0
  137. package/dist/module/workflow/service/populate-workflow.service.d.ts +21 -0
  138. package/dist/module/workflow/service/populate-workflow.service.js +124 -0
  139. package/dist/module/workflow/service/populate-workflow.service.js.map +1 -0
  140. package/dist/module/workflow/service/stage-group.service.d.ts +13 -0
  141. package/dist/module/workflow/service/stage-group.service.js +39 -1
  142. package/dist/module/workflow/service/stage-group.service.js.map +1 -1
  143. package/dist/module/workflow/service/stage.service.d.ts +14 -4
  144. package/dist/module/workflow/service/stage.service.js +57 -13
  145. package/dist/module/workflow/service/stage.service.js.map +1 -1
  146. package/dist/module/workflow/service/task.service.d.ts +18 -0
  147. package/dist/module/workflow/service/task.service.js +63 -0
  148. package/dist/module/workflow/service/task.service.js.map +1 -0
  149. package/dist/module/workflow/service/workflow-list-master.service.js +4 -4
  150. package/dist/module/workflow/service/workflow-meta.service.d.ts +20 -0
  151. package/dist/module/workflow/service/workflow-meta.service.js +137 -0
  152. package/dist/module/workflow/service/workflow-meta.service.js.map +1 -0
  153. package/dist/module/workflow/service/workflow.service.d.ts +28 -5
  154. package/dist/module/workflow/service/workflow.service.js +108 -41
  155. package/dist/module/workflow/service/workflow.service.js.map +1 -1
  156. package/dist/module/workflow/workflow.module.js +82 -15
  157. package/dist/module/workflow/workflow.module.js.map +1 -1
  158. package/dist/tsconfig.build.tsbuildinfo +1 -1
  159. package/package.json +1 -1
  160. package/src/constant/global.constant.ts +3 -1
  161. package/src/module/enterprise/repository/school.repository.ts +23 -2
  162. package/src/module/filter/controller/filter.controller.ts +10 -4
  163. package/src/module/filter/dto/filter-request.dto.ts +1 -0
  164. package/src/module/filter/service/filter.service.ts +39 -5
  165. package/src/module/layout_preference/controller/layout_preference.controller.ts +6 -4
  166. package/src/module/layout_preference/entity/layout_preference.entity.ts +11 -0
  167. package/src/module/layout_preference/repository/layout_preference.repository.ts +6 -2
  168. package/src/module/layout_preference/service/layout_preference.service.ts +31 -6
  169. package/src/module/listmaster/entity/list-master-items.entity.ts +5 -5
  170. package/src/module/meta/controller/media.controller.ts +5 -7
  171. package/src/module/meta/entity/base-entity.entity.ts +1 -1
  172. package/src/module/module/controller/module-access.controller.ts +9 -4
  173. package/src/module/module/service/module-access.service.ts +15 -8
  174. package/src/module/workflow/controller/action-category.controller.ts +35 -0
  175. package/src/module/workflow/controller/action.controller.ts +73 -0
  176. package/src/module/workflow/controller/comm-template.controller.ts +32 -0
  177. package/src/module/workflow/controller/entity-modification.controller.ts +35 -0
  178. package/src/module/workflow/controller/stage-group.controller.ts +33 -0
  179. package/src/module/workflow/controller/stage.controller.ts +50 -0
  180. package/src/module/workflow/controller/task.controller.ts +57 -0
  181. package/src/module/workflow/controller/workflow-meta.controller.ts +76 -0
  182. package/src/module/workflow/controller/workflow.controller.ts +32 -12
  183. package/src/module/workflow/entity/action-category.entity.ts +3 -0
  184. package/src/module/workflow/entity/action-data.entity.ts +43 -0
  185. package/src/module/workflow/entity/action.entity.ts +18 -3
  186. package/src/module/workflow/entity/comm-template.entity.ts +18 -1
  187. package/src/module/workflow/entity/entity-modification.entity.ts +38 -0
  188. package/src/module/workflow/entity/stage-group.entity.ts +1 -1
  189. package/src/module/workflow/entity/stage-movement-data.entity.ts +12 -0
  190. package/src/module/workflow/entity/stage.entity.ts +4 -4
  191. package/src/module/workflow/entity/task-data.entity.ts +73 -0
  192. package/src/module/workflow/entity/template-attach-mapper.entity.ts +30 -0
  193. package/src/module/workflow/entity/workflow-level-mapping.entity.ts +18 -0
  194. package/src/module/workflow/entity/workflow.entity.ts +6 -0
  195. package/src/module/workflow/repository/action-data.repository.ts +93 -0
  196. package/src/module/workflow/repository/action.repository.ts +104 -0
  197. package/src/module/workflow/repository/comm-template.repository.ts +102 -0
  198. package/src/module/workflow/repository/stage-group.repository.ts +46 -0
  199. package/src/module/workflow/repository/stage-movement.repository.ts +219 -0
  200. package/src/module/workflow/repository/stage.repository.ts +47 -0
  201. package/src/module/workflow/repository/task.repository.ts +85 -0
  202. package/src/module/workflow/repository/workflow.repository.ts +40 -2
  203. package/src/module/workflow/service/action-category.service.ts +26 -1
  204. package/src/module/workflow/service/action-data.service.ts +45 -0
  205. package/src/module/workflow/service/action-template-mapping.service.ts +1 -1
  206. package/src/module/workflow/service/action.service.ts +279 -19
  207. package/src/module/workflow/service/comm-template.service.ts +90 -1
  208. package/src/module/workflow/service/entity-modification.service.ts +67 -0
  209. package/src/module/workflow/service/populate-workflow.service.ts +189 -0
  210. package/src/module/workflow/service/stage-group.service.ts +67 -2
  211. package/src/module/workflow/service/stage.service.ts +104 -28
  212. package/src/module/workflow/service/task.service.ts +95 -0
  213. package/src/module/workflow/service/workflow-list-master.service.ts +4 -4
  214. package/src/module/workflow/service/workflow-meta.service.ts +231 -0
  215. package/src/module/workflow/service/workflow.service.ts +181 -50
  216. package/src/module/workflow/workflow.module.ts +82 -15
@@ -5,14 +5,52 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
8
14
  Object.defineProperty(exports, "__esModule", { value: true });
9
15
  exports.StageGroupService = void 0;
10
16
  const common_1 = require("@nestjs/common");
11
17
  const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
18
+ const stage_group_repository_1 = require("../repository/stage-group.repository");
19
+ const stage_service_1 = require("./stage.service");
20
+ const typeorm_1 = require("typeorm");
12
21
  let StageGroupService = class StageGroupService extends entity_service_impl_service_1.EntityServiceImpl {
22
+ constructor(stageGroupRepository, stageService, dataSource) {
23
+ super();
24
+ this.stageGroupRepository = stageGroupRepository;
25
+ this.stageService = stageService;
26
+ this.dataSource = dataSource;
27
+ }
28
+ async getAllStageGroup(workflow_id, level_id, level_type) {
29
+ return await this.stageGroupRepository.getAllStageGroup(workflow_id, level_id, level_type);
30
+ }
31
+ async updateEntity(entityData, loggedInUser) {
32
+ return await super.updateEntity(entityData, loggedInUser);
33
+ }
34
+ async getEntityData(entityType, id, loggedInUser) {
35
+ return await super.getEntityData(entityType, id, loggedInUser);
36
+ }
37
+ async deleteEntity(entityType, id, loggedInUser) {
38
+ const getAllStage = await this.dataSource.query(`SELECT id FROM cr_wf_stage WHERE stage_group_id = ? AND level_id =? AND level_type = ?`, [id, loggedInUser.level_id, loggedInUser.level_type]);
39
+ if (getAllStage.length > 0) {
40
+ for (const stage of getAllStage) {
41
+ await this.stageService.deleteEntity('STG', stage.id, loggedInUser);
42
+ }
43
+ }
44
+ const deleteStageGroup = await super.deleteEntity(entityType, id, loggedInUser);
45
+ return deleteStageGroup;
46
+ }
13
47
  };
14
48
  exports.StageGroupService = StageGroupService;
15
49
  exports.StageGroupService = StageGroupService = __decorate([
16
- (0, common_1.Injectable)()
50
+ (0, common_1.Injectable)(),
51
+ __param(1, (0, common_1.Inject)('StageService')),
52
+ __metadata("design:paramtypes", [stage_group_repository_1.StageGroupRepository,
53
+ stage_service_1.StageService,
54
+ typeorm_1.DataSource])
17
55
  ], StageGroupService);
18
56
  //# sourceMappingURL=stage-group.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stage-group.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/stage-group.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,gGAAwF;AAGjF,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,+CAAiB;CAAG,CAAA;AAA9C,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;GACA,iBAAiB,CAA6B"}
1
+ {"version":3,"file":"stage-group.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/stage-group.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,gGAAwF;AACxF,iFAA4E;AAG5E,mDAA+C;AAC/C,qCAAqC;AAG9B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,+CAAiB;IACtD,YACmB,oBAA0C,EAE1C,YAA0B,EAC1B,UAAsB;QAEvC,KAAK,EAAE,CAAC;QALS,yBAAoB,GAApB,oBAAoB,CAAsB;QAE1C,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAY;IAGzC,CAAC;IACD,KAAK,CAAC,gBAAgB,CACpB,WAAmB,EACnB,QAAgB,EAChB,UAAkB;QAElB,OAAO,MAAM,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CACrD,WAAW,EACX,QAAQ,EACR,UAAU,CACX,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,UAAsB,EACtB,YAAsB;QAEtB,OAAO,MAAM,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,UAAkB,EAClB,EAAU,EACV,YAAuB;QAEvB,OAAO,MAAM,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,UAAkB,EAClB,EAAU,EACV,YAAsB;QAEtB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAC7C,wFAAwF,EACxF,CAAC,EAAE,EAAE,YAAY,CAAC,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CACrD,CAAC;QAEF,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;gBAChC,MAAM,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAED,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,YAAY,CAC/C,UAAU,EACV,EAAE,EACF,YAAY,CACb,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF,CAAA;AA5DY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,eAAM,EAAC,cAAc,CAAC,CAAA;qCADgB,6CAAoB;QAE5B,4BAAY;QACd,oBAAU;GAL9B,iBAAiB,CA4D7B"}
@@ -1,9 +1,19 @@
1
- import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
1
+ import { ActionService } from './action.service';
2
2
  import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
3
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
3
4
  import { UserData } from 'src/module/user/entity/user.entity';
4
- import { DataSource, EntityManager } from 'typeorm';
5
+ import { StageRepository } from '../repository/stage.repository';
6
+ import { DataSource } from 'typeorm';
7
+ import { StageGroupRepository } from '../repository/stage-group.repository';
5
8
  export declare class StageService extends EntityServiceImpl {
9
+ private readonly stageRepository;
10
+ private readonly stageGroupRepository;
6
11
  private readonly dataSource;
7
- constructor(dataSource: DataSource);
8
- createEntity(entityData: BaseEntity, loggedInUser: UserData | null, manager?: EntityManager | null, appcode?: string): Promise<any>;
12
+ private readonly actionService;
13
+ constructor(stageRepository: StageRepository, stageGroupRepository: StageGroupRepository, dataSource: DataSource, actionService: ActionService);
14
+ getAllStage(stage_group_id: number, level_id: string, level_type: string): Promise<import("../entity/stage.entity").Stage[]>;
15
+ updateEntity(entityData: BaseEntity, loggedInUser: UserData): Promise<any>;
16
+ getEntityData(entityType: string, id: number, loggedInUser?: UserData): Promise<BaseEntity | null>;
17
+ deleteEntity(entityType: string, id: number, loggedInUser: UserData): Promise<any>;
18
+ getStagesWithGroupName(workflow_id: number, level_id: string, level_type: string): Promise<any>;
9
19
  }
@@ -8,35 +8,79 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.StageService = void 0;
16
+ const action_service_1 = require("./action.service");
13
17
  const common_1 = require("@nestjs/common");
14
18
  const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
19
+ const stage_repository_1 = require("../repository/stage.repository");
15
20
  const typeorm_1 = require("typeorm");
21
+ const stage_group_repository_1 = require("../repository/stage-group.repository");
16
22
  let StageService = class StageService extends entity_service_impl_service_1.EntityServiceImpl {
17
- constructor(dataSource) {
23
+ constructor(stageRepository, stageGroupRepository, dataSource, actionService) {
18
24
  super();
25
+ this.stageRepository = stageRepository;
26
+ this.stageGroupRepository = stageGroupRepository;
19
27
  this.dataSource = dataSource;
28
+ this.actionService = actionService;
29
+ }
30
+ async getAllStage(stage_group_id, level_id, level_type) {
31
+ return await this.stageRepository.getAllStage(stage_group_id, level_id, level_type);
32
+ }
33
+ async updateEntity(entityData, loggedInUser) {
34
+ return await super.updateEntity(entityData, loggedInUser);
35
+ }
36
+ async getEntityData(entityType, id, loggedInUser) {
37
+ return await super.getEntityData(entityType, id, loggedInUser);
20
38
  }
21
- async createEntity(entityData, loggedInUser, manager, appcode) {
22
- const stageData = entityData;
23
- let stageGroupName = '';
24
- if (stageData.stage_group_id) {
25
- const result = await this.dataSource.query(`SELECT name FROM cr_wf_stage_group WHERE id = ?`, [stageData.stage_group_id]);
26
- if (result.length > 0) {
27
- stageGroupName = result[0].name;
39
+ async deleteEntity(entityType, id, loggedInUser) {
40
+ const getAllStageAction = await this.dataSource.query(`SELECT action_id FROM cr_wf_stage_action_mapping WHERE stage_id = ? AND entity_type = 'STGM'`, [id]);
41
+ if (getAllStageAction.length > 0) {
42
+ for (const action of getAllStageAction) {
43
+ await this.actionService.deleteEntity('ACTN', action.action_id, loggedInUser);
28
44
  }
29
45
  }
30
- if (stageGroupName && stageData.name) {
31
- stageData.full_name = `${stageGroupName}-${stageData.name}`;
46
+ const deleteStage = await super.deleteEntity(entityType, id, loggedInUser);
47
+ return deleteStage;
48
+ }
49
+ async getStagesWithGroupName(workflow_id, level_id, level_type) {
50
+ if (!workflow_id) {
51
+ throw new common_1.BadRequestException('workflow_id is required');
52
+ }
53
+ const stageGroups = await this.stageGroupRepository.getAllStageGroup(workflow_id, level_id, level_type);
54
+ const stageGroupIds = stageGroups.map((group) => group.id);
55
+ const groupNameMap = new Map(stageGroups.map((group) => [Number(group.id), group.name]));
56
+ const allStages = [];
57
+ for (const groupId of stageGroupIds) {
58
+ try {
59
+ const stages = await this.stageRepository.getAllStage(groupId, level_id, level_type);
60
+ allStages.push(...stages);
61
+ }
62
+ catch (err) {
63
+ if (err instanceof common_1.NotFoundException) {
64
+ console.warn(`No stages for group ID ${groupId}`);
65
+ continue;
66
+ }
67
+ throw err;
68
+ }
32
69
  }
33
- const savedStage = await super.createEntity(stageData, loggedInUser, manager, appcode);
34
- return savedStage;
70
+ const result = allStages.map((stage) => ({
71
+ stage_id: stage.id,
72
+ full_name: `${groupNameMap.get(stage.stage_group_id)} - ${stage.name}`,
73
+ }));
74
+ return result;
35
75
  }
36
76
  };
37
77
  exports.StageService = StageService;
38
78
  exports.StageService = StageService = __decorate([
39
79
  (0, common_1.Injectable)(),
40
- __metadata("design:paramtypes", [typeorm_1.DataSource])
80
+ __param(3, (0, common_1.Inject)('ActionService')),
81
+ __metadata("design:paramtypes", [stage_repository_1.StageRepository,
82
+ stage_group_repository_1.StageGroupRepository,
83
+ typeorm_1.DataSource,
84
+ action_service_1.ActionService])
41
85
  ], StageService);
42
86
  //# sourceMappingURL=stage.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stage.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/stage.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,gGAAwF;AAExF,qCAAoD;AAG7C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,+CAAiB;IACjD,YAA6B,UAAsB;QACjD,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,UAAsB,EACtB,YAA6B,EAC7B,OAA8B,EAC9B,OAAgB;QAEhB,MAAM,SAAS,GAAG,UAAiB,CAAC;QAGpC,IAAI,cAAc,GAAG,EAAE,CAAC;QACxB,IAAI,SAAS,CAAC,cAAc,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACxC,iDAAiD,EACjD,CAAC,SAAS,CAAC,cAAc,CAAC,CAC3B,CAAC;YAEF,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAClC,CAAC;QACH,CAAC;QAED,IAAI,cAAc,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;YACrC,SAAS,CAAC,SAAS,GAAG,GAAG,cAAc,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;QAC9D,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,YAAY,CACzC,SAAS,EACT,YAAY,EACZ,OAAO,EACP,OAAO,CACR,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAvCY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAE8B,oBAAU;GADxC,YAAY,CAuCxB"}
1
+ {"version":3,"file":"stage.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/stage.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qDAAiD;AACjD,2CAKwB;AACxB,gGAAwF;AAGxF,qEAAiE;AACjE,qCAAqC;AACrC,iFAA4E;AAGrE,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,+CAAiB;IACjD,YACmB,eAAgC,EAChC,oBAA0C,EAC1C,UAAsB,EAEtB,aAA4B;QAE7C,KAAK,EAAE,CAAC;QANS,oBAAe,GAAf,eAAe,CAAiB;QAChC,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,eAAU,GAAV,UAAU,CAAY;QAEtB,kBAAa,GAAb,aAAa,CAAe;IAG/C,CAAC;IACD,KAAK,CAAC,WAAW,CACf,cAAsB,EACtB,QAAgB,EAChB,UAAkB;QAElB,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CAC3C,cAAc,EACd,QAAQ,EACR,UAAU,CACX,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,UAAsB,EACtB,YAAsB;QAEtB,OAAO,MAAM,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,UAAkB,EAClB,EAAU,EAC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,SAAS,GAAQ,EAAE,CAAC;QAC1B,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;YACpC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CACnD,OAAO,EACP,QAAQ,EACR,UAAU,CACX,CAAC;gBACF,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;YAC5B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,0BAAiB,EAAE,CAAC;oBACrC,OAAO,CAAC,IAAI,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC;oBAClD,SAAS;gBACX,CAAC;gBACD,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACvC,QAAQ,EAAE,KAAK,CAAC,EAAE;YAClB,SAAS,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE;SACvE,CAAC,CAAC,CAAC;QACJ,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AA3GY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;qCAHU,kCAAe;QACV,6CAAoB;QAC9B,oBAAU;QAEP,8BAAa;GANpC,YAAY,CA2GxB"}
@@ -0,0 +1,18 @@
1
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
2
+ import { UserData } from 'src/module/user/entity/user.entity';
3
+ import { TaskRepository } from '../repository/task.repository';
4
+ import { ActionDataService } from './action-data.service';
5
+ export declare class TaskService extends EntityServiceImpl {
6
+ private readonly taskRepository;
7
+ private readonly actionDataService;
8
+ constructor(taskRepository: TaskRepository, actionDataService: ActionDataService);
9
+ getAllTaskByUserIdandStageId(loggedInUser: UserData, data: any): Promise<any>;
10
+ getEntityData(entityType: string, id: number, loggedInUser: any): Promise<import("../../meta/entity/base-entity.entity").BaseEntity | null>;
11
+ saveActionData(action: any, loggedInUser: UserData, mapped_entity_id: number, mapped_entity_type: string): Promise<any>;
12
+ moveTask(loggedInUser: UserData, body: {
13
+ mapped_entity_type: string;
14
+ mapped_entity_id: number;
15
+ stage_id: number;
16
+ action_id: number;
17
+ }): Promise<any>;
18
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TaskService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
15
+ const task_repository_1 = require("../repository/task.repository");
16
+ const action_data_service_1 = require("./action-data.service");
17
+ let TaskService = class TaskService extends entity_service_impl_service_1.EntityServiceImpl {
18
+ constructor(taskRepository, actionDataService) {
19
+ super();
20
+ this.taskRepository = taskRepository;
21
+ this.actionDataService = actionDataService;
22
+ }
23
+ async getAllTaskByUserIdandStageId(loggedInUser, data) {
24
+ const taskData = await this.taskRepository.getAllTaskByUserIdAndStageId({
25
+ user_id: data.user_id,
26
+ stage_id: data.stage_id,
27
+ mapped_entity_type: data.mapped_entity_type,
28
+ mapped_entity_id: data.mapped_entity_id,
29
+ });
30
+ const grouped = {
31
+ mandatory: [],
32
+ non_mandatory: [],
33
+ };
34
+ for (const task of taskData) {
35
+ if (task && task.is_mandatory) {
36
+ grouped.mandatory.push(task);
37
+ }
38
+ else {
39
+ grouped.non_mandatory.push(task);
40
+ }
41
+ }
42
+ return grouped;
43
+ }
44
+ async getEntityData(entityType, id, loggedInUser) {
45
+ const taskData = await super.getEntityData(entityType, id, loggedInUser);
46
+ return taskData;
47
+ }
48
+ async saveActionData(action, loggedInUser, mapped_entity_id, mapped_entity_type) {
49
+ await this.taskRepository.saveActionDataInTask(action, loggedInUser, mapped_entity_id, mapped_entity_type);
50
+ }
51
+ async moveTask(loggedInUser, body) {
52
+ this.taskRepository.updateTaskStatus(loggedInUser, body.mapped_entity_type, body.mapped_entity_id, body.stage_id, body.action_id);
53
+ await this.actionDataService.updateActionStatus(loggedInUser, body.mapped_entity_type, body.mapped_entity_id, body.stage_id, body.action_id);
54
+ return 'Task moved successfully';
55
+ }
56
+ };
57
+ exports.TaskService = TaskService;
58
+ exports.TaskService = TaskService = __decorate([
59
+ (0, common_1.Injectable)(),
60
+ __metadata("design:paramtypes", [task_repository_1.TaskRepository,
61
+ action_data_service_1.ActionDataService])
62
+ ], TaskService);
63
+ //# sourceMappingURL=task.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/task.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,gGAAwF;AAExF,mEAA+D;AAC/D,+DAA0D;AAGnD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,+CAAiB;IAChD,YACmB,cAA8B,EAC9B,iBAAoC;QAErD,KAAK,EAAE,CAAC;QAHS,mBAAc,GAAd,cAAc,CAAgB;QAC9B,sBAAiB,GAAjB,iBAAiB,CAAmB;IAGvD,CAAC;IAED,KAAK,CAAC,4BAA4B,CAChC,YAAsB,EACtB,IAAI;Q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,SAAS,CACf,CAAC;QAGF,MAAM,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CAC7C,YAAY,EACZ,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,SAAS,CACf,CAAC;QAEF,OAAO,yBAAyB,CAAC;IACnC,CAAC;CACF,CAAA;AAvFY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAGwB,gCAAc;QACX,uCAAiB;GAH5C,WAAW,CAuFvB"}
@@ -21,18 +21,18 @@ let WorkflowListMasterService = class WorkflowListMasterService extends entity_s
21
21
  async getActionCategoryListByStageId(stageId) {
22
22
  const results = await this.dataSource.query(`
23
23
  SELECT
24
- ac.logo AS logo,
25
- ac.name AS name,
24
+ ac.name AS name,
25
+ ac.logo AS logo,
26
26
  ac.modalName AS modalName,
27
27
  a.action_requirement AS actionRequirement
28
28
  FROM cr_wf_stage_action_mapping sam
29
29
  JOIN cr_wf_action a ON sam.action_id = a.id
30
- JOIN cr_wf_action_category ac ON a.action_cat_id = ac.id
30
+ JOIN cr_wf_action_category ac ON a.action_category = ac.id
31
31
  WHERE sam.stage_id = ?
32
32
  `, [stageId]);
33
33
  return results.map((item) => ({
34
- logo: item.logo,
35
34
  name: item.name,
35
+ logo: item.logo,
36
36
  modalName: item.modalName,
37
37
  actionRequirement: item.actionRequirement,
38
38
  actionStatus: 'Done',
@@ -0,0 +1,20 @@
1
+ import { Repository, DataSource } from 'typeorm';
2
+ import { StageMovementData } from '../entity/stage-movement-data.entity';
3
+ import { UserData } from 'src/module/user/entity/user.entity';
4
+ import { StageMovementRepository } from '../repository/stage-movement.repository';
5
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
6
+ import { ActionDataService } from './action-data.service';
7
+ import { TaskService } from './task.service';
8
+ export declare class WorkflowMetaService extends EntityServiceImpl {
9
+ private readonly stageMovementRepo;
10
+ private readonly stageMovementRepository;
11
+ private readonly dataSource;
12
+ private readonly actionDataService;
13
+ private readonly taskService;
14
+ constructor(stageMovementRepo: Repository<StageMovementData>, stageMovementRepository: StageMovementRepository, dataSource: DataSource, actionDataService: ActionDataService, taskService: TaskService);
15
+ getFirstStage(loggedInUser: UserData, mapped_entity_type: string, mapped_entity_id: number): Promise<any | null>;
16
+ getCurrentStage(mapped_entity_type: string, mapped_entity_id: number, loggedInUser: UserData): Promise<any | null>;
17
+ getNextStage(currentStage: any): Promise<any | null>;
18
+ moveToNextStage(mapped_entity_type: string, mapped_entity_id: number, loggedInUser: UserData): Promise<string>;
19
+ populateActionService(stage_id: number, loggedInUser: UserData, mapped_entity_id: number, mapped_entity_type: string): Promise<any>;
20
+ }
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.WorkflowMetaService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const typeorm_1 = require("@nestjs/typeorm");
18
+ const typeorm_2 = require("typeorm");
19
+ const stage_movement_data_entity_1 = require("../entity/stage-movement-data.entity");
20
+ const stage_movement_repository_1 = require("../repository/stage-movement.repository");
21
+ const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
22
+ const action_data_service_1 = require("./action-data.service");
23
+ const task_service_1 = require("./task.service");
24
+ let WorkflowMetaService = class WorkflowMetaService extends entity_service_impl_service_1.EntityServiceImpl {
25
+ constructor(stageMovementRepo, stageMovementRepository, dataSource, actionDataService, taskService) {
26
+ super();
27
+ this.stageMovementRepo = stageMovementRepo;
28
+ this.stageMovementRepository = stageMovementRepository;
29
+ this.dataSource = dataSource;
30
+ this.actionDataService = actionDataService;
31
+ this.taskService = taskService;
32
+ }
33
+ async getFirstStage(loggedInUser, mapped_entity_type, mapped_entity_id) {
34
+ return this.stageMovementRepository.getFirstStage({
35
+ loggedInUser,
36
+ mapped_entity_type,
37
+ mapped_entity_id,
38
+ });
39
+ }
40
+ async getCurrentStage(mapped_entity_type, mapped_entity_id, loggedInUser) {
41
+ let currentStage = await this.stageMovementRepo.findOne({
42
+ where: {
43
+ mapped_entity_type,
44
+ mapped_entity_id,
45
+ is_current: 'Y',
46
+ },
47
+ });
48
+ if (!currentStage) {
49
+ return null;
50
+ }
51
+ const getGroupName = await this.dataSource.query(`SELECT name FROM cr_wf_stage_group WHERE id = ${currentStage?.stage_group_id}`);
52
+ return {
53
+ ...currentStage,
54
+ stage_group_name: getGroupName[0]?.name,
55
+ };
56
+ }
57
+ async getNextStage(currentStage) {
58
+ const nextStage = await this.stageMovementRepository.getNextStageOrFirstOfNextGroup(currentStage?.stage_group_id, currentStage?.stage_id);
59
+ if (!nextStage) {
60
+ return { hasNextStage: false, nextStage: null };
61
+ }
62
+ const groupName = await this.dataSource.query(`SELECT name FROM cr_wf_stage_group WHERE id = ${nextStage?.stage_group_id}`);
63
+ return {
64
+ hasNextStage: !!nextStage,
65
+ nextStage: { ...nextStage, stage_group_name: groupName[0]?.name },
66
+ };
67
+ }
68
+ async moveToNextStage(mapped_entity_type, mapped_entity_id, loggedInUser) {
69
+ const now = new Date();
70
+ let currentStage = await this.getCurrentStage(mapped_entity_type, mapped_entity_id, loggedInUser);
71
+ if (!currentStage) {
72
+ const getAllResult = await this.getFirstStage(loggedInUser, mapped_entity_type, mapped_entity_id);
73
+ const { mappingUsed, stageGroup, firstStage } = getAllResult;
74
+ currentStage = await this.stageMovementRepo.save({
75
+ entity_type: 'STGM',
76
+ mapped_entity_type,
77
+ mapped_entity_id,
78
+ name: firstStage.name,
79
+ status: firstStage.status,
80
+ current_user_id: loggedInUser.id,
81
+ stage_action_mapping_id: firstStage.id,
82
+ stage_group_id: stageGroup.id,
83
+ stage_id: firstStage.id,
84
+ start_date: new Date(),
85
+ is_current: 'Y',
86
+ });
87
+ this.populateActionService(currentStage.stage_id, loggedInUser, mapped_entity_id, mapped_entity_type);
88
+ return `Initialized workflow with first stage (Stage ID: ${firstStage.id}).`;
89
+ }
90
+ const stageDate = await this.getNextStage(currentStage);
91
+ if (stageDate.hasNextStage) {
92
+ const { nextStage } = stageDate;
93
+ currentStage.end_date = now;
94
+ currentStage.is_current = 'N';
95
+ await this.stageMovementRepo.save(currentStage);
96
+ await this.stageMovementRepo.save({
97
+ entity_type: 'STGM',
98
+ mapped_entity_type,
99
+ mapped_entity_id,
100
+ name: nextStage.name,
101
+ status: nextStage.status,
102
+ current_user_id: loggedInUser.id,
103
+ stage_action_mapping_id: nextStage.id,
104
+ start_date: now,
105
+ stage_group_id: nextStage?.stage_group_id,
106
+ stage_id: nextStage.id,
107
+ is_current: 'Y',
108
+ });
109
+ this.populateActionService(currentStage.stage_id, loggedInUser, mapped_entity_id, mapped_entity_type);
110
+ return `Moved to next stage (Stage ID: ${nextStage.id}).`;
111
+ }
112
+ currentStage.end_date = now;
113
+ currentStage.is_current = 'N';
114
+ await this.stageMovementRepo.save(currentStage);
115
+ return 'Workflow completed. No next stage available.';
116
+ }
117
+ async populateActionService(stage_id, loggedInUser, mapped_entity_id, mapped_entity_type) {
118
+ const actions = await this.stageMovementRepository.getAllActionByStageId(stage_id);
119
+ if (!actions || actions.length === 0) {
120
+ return 'No actions found for this stage.';
121
+ }
122
+ await this.actionDataService.saveActionData(actions, loggedInUser, mapped_entity_id, mapped_entity_type);
123
+ await this.taskService.saveActionData(actions, loggedInUser, mapped_entity_id, mapped_entity_type);
124
+ }
125
+ };
126
+ exports.WorkflowMetaService = WorkflowMetaService;
127
+ exports.WorkflowMetaService = WorkflowMetaService = __decorate([
128
+ (0, common_1.Injectable)(),
129
+ __param(0, (0, typeorm_1.InjectRepository)(stage_movement_data_entity_1.StageMovementData)),
130
+ __param(4, (0, common_1.Inject)('TaskService')),
131
+ __metadata("design:paramtypes", [typeorm_2.Repository,
132
+ stage_movement_repository_1.StageMovementRepository,
133
+ typeorm_2.DataSource,
134
+ action_data_service_1.ActionDataService,
135
+ task_service_1.TaskService])
136
+ ], WorkflowMetaService);
137
+ //# sourceMappingURL=workflow-meta.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-meta.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/workflow-meta.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2CAAoD;AACpD,6CAAmD;AACnD,qCAAiD;AACjD,qFAAyE;AAEzE,uFAAkF;AAClF,gGAAwF;AACxF,+DAA0D;AAC1D,iDAA6C;AAGtC,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,+CAAiB;IACxD,YAEmB,iBAAgD,EAChD,uBAAgD,EAChD,UAAsB,EACtB,iBAAoC,EAEpC,WAAwB;QAEzC,KAAK,EAAE,CAAC;QAPS,sBAAiB,GAAjB,iBAAiB,CAA+B;QAChD,4BAAuB,GAAvB,uBAAuB,CAAyB;QAChD,eAAU,GAAV,UAAU,CAAY;QACtB,sBAAiB,GAAjB,iBAAiB,CAAmB;QAEpC,gBAAW,GAAX,WAAW,CAAa;IAG3C,CAAC;IAGD,KAAK,CAAC,aAAa,CACjB,YAAsB,EACtB,kBAA0B,EAC1B,gBAAwB;QAMxB,OAAO,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC;YAChD,YAAY;YACZ,kBAAkB;YAClB,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YAAY,EACZ,gBAAgB,EAChB,kBAAkB,CACnB,CAAC;IACJ,CAAC;CACF,CAAA;AA1NY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,8CAAiB,CAAC,CAAA;IAKnC,WAAA,IAAA,eAAM,EAAC,aAAa,CAAC,CAAA;qCAJc,oBAAU;QACJ,mDAAuB;QACpC,oBAAU;QACH,uCAAiB;QAEvB,0BAAW;GARhC,mBAAmB,CA0N/B"}
@@ -1,10 +1,33 @@
1
+ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
2
+ import { DataSource } from 'typeorm';
3
+ import { WorkflowRepository } from '../repository/workflow.repository';
4
+ import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
1
5
  import { UserData } from 'src/module/user/entity/user.entity';
2
- import { BaseEntity, DataSource } from 'typeorm';
3
- export declare class WorkflowService {
6
+ import { ListMasterService } from 'src/module/listmaster/service/list-master.service';
7
+ import { Workflow } from '../entity/workflow.entity';
8
+ import { StageGroupRepository } from '../repository/stage-group.repository';
9
+ import { StageGroupService } from './stage-group.service';
10
+ export declare class WorkflowService extends EntityServiceImpl {
4
11
  private readonly dataSource;
5
- constructor(dataSource: DataSource);
6
- getAllWorkflow(entity_type: string, loggedInUser: any): Promise<any>;
12
+ private readonly workflowRepository;
13
+ private readonly listMasterService;
14
+ private readonly stateGroupService;
15
+ private readonly stageGroupRepository;
16
+ constructor(dataSource: DataSource, workflowRepository: WorkflowRepository, listMasterService: ListMasterService, stateGroupService: StageGroupService, stageGroupRepository: StageGroupRepository);
17
+ getAllWorkflows(entity_type: string, level_id: string, level_type: string): Promise<Workflow[]>;
7
18
  getWorkflowById(id: number): Promise<any>;
8
19
  updateEntity(entityData: BaseEntity, loggedInUser: UserData): Promise<any>;
9
- getLeadContactDropdown(leadId: number, mode: string): Promise<any[]>;
20
+ deleteWorkflowById(id: number): Promise<{
21
+ message: string;
22
+ }>;
23
+ deleteEntity(entityType: string, id: number, loggedInUser: UserData): Promise<any>;
24
+ updateSequence(body: any[], loggedInUser: any): Promise<{
25
+ updated: number;
26
+ results: {
27
+ id: any;
28
+ success: boolean;
29
+ result?: any;
30
+ error?: string;
31
+ }[];
32
+ }>;
10
33
  }