rez_core 2.1.145 → 2.1.148
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.
- package/dist/module/layout_preference/controller/layout_preference.controller.js +2 -2
- package/dist/module/layout_preference/controller/layout_preference.controller.js.map +1 -1
- package/dist/module/layout_preference/entity/layout_preference.entity.d.ts +2 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.js +13 -0
- package/dist/module/layout_preference/entity/layout_preference.entity.js.map +1 -1
- package/dist/module/layout_preference/repository/layout_preference.repository.d.ts +1 -1
- package/dist/module/layout_preference/repository/layout_preference.repository.js +4 -2
- package/dist/module/layout_preference/repository/layout_preference.repository.js.map +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.d.ts +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.js +10 -4
- package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -1
- package/dist/module/meta/controller/media.controller.d.ts +1 -1
- package/dist/module/meta/controller/media.controller.js +1 -1
- package/dist/module/meta/controller/media.controller.js.map +1 -1
- package/dist/module/workflow/controller/action-category.controller.d.ts +8 -0
- package/dist/module/workflow/controller/action-category.controller.js +45 -0
- package/dist/module/workflow/controller/action-category.controller.js.map +1 -0
- package/dist/module/workflow/controller/action.controller.d.ts +1 -1
- package/dist/module/workflow/controller/action.controller.js +3 -3
- package/dist/module/workflow/controller/action.controller.js.map +1 -1
- package/dist/module/workflow/controller/comm-template.controller.d.ts +2 -2
- package/dist/module/workflow/controller/comm-template.controller.js +4 -4
- package/dist/module/workflow/controller/comm-template.controller.js.map +1 -1
- package/dist/module/workflow/controller/workflow-meta.controller.d.ts +9 -0
- package/dist/module/workflow/controller/workflow-meta.controller.js +63 -0
- package/dist/module/workflow/controller/workflow-meta.controller.js.map +1 -0
- package/dist/module/workflow/controller/workflow.controller.d.ts +9 -1
- package/dist/module/workflow/controller/workflow.controller.js +17 -2
- package/dist/module/workflow/controller/workflow.controller.js.map +1 -1
- package/dist/module/workflow/entity/action-category.entity.d.ts +1 -0
- package/dist/module/workflow/entity/action-category.entity.js +4 -0
- package/dist/module/workflow/entity/action-category.entity.js.map +1 -1
- package/dist/module/workflow/entity/action.entity.d.ts +2 -2
- package/dist/module/workflow/entity/action.entity.js +3 -3
- package/dist/module/workflow/entity/action.entity.js.map +1 -1
- package/dist/module/workflow/entity/comm-template.entity.d.ts +5 -0
- package/dist/module/workflow/entity/comm-template.entity.js +21 -1
- package/dist/module/workflow/entity/comm-template.entity.js.map +1 -1
- package/dist/module/workflow/entity/stage-movement-data.entity.d.ts +2 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js +8 -0
- package/dist/module/workflow/entity/stage-movement-data.entity.js.map +1 -1
- package/dist/module/workflow/entity/template-attach-mapper.entity.d.ts +11 -0
- package/dist/module/workflow/entity/template-attach-mapper.entity.js +54 -0
- package/dist/module/workflow/entity/template-attach-mapper.entity.js.map +1 -0
- package/dist/module/workflow/repository/comm-template.repository.d.ts +8 -2
- package/dist/module/workflow/repository/comm-template.repository.js +37 -6
- package/dist/module/workflow/repository/comm-template.repository.js.map +1 -1
- package/dist/module/workflow/service/action-category.service.d.ts +5 -0
- package/dist/module/workflow/service/action-category.service.js +23 -1
- package/dist/module/workflow/service/action-category.service.js.map +1 -1
- package/dist/module/workflow/service/action.service.d.ts +1 -1
- package/dist/module/workflow/service/action.service.js +78 -26
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/comm-template.service.d.ts +4 -1
- package/dist/module/workflow/service/comm-template.service.js +38 -1
- package/dist/module/workflow/service/comm-template.service.js.map +1 -1
- package/dist/module/workflow/service/populate-workflow.service.d.ts +21 -0
- package/dist/module/workflow/service/populate-workflow.service.js +124 -0
- package/dist/module/workflow/service/populate-workflow.service.js.map +1 -0
- package/dist/module/workflow/service/workflow-list-master.service.js +3 -3
- package/dist/module/workflow/service/workflow-meta.service.d.ts +9 -0
- package/dist/module/workflow/service/workflow-meta.service.js +81 -0
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -0
- package/dist/module/workflow/workflow.module.js +41 -26
- package/dist/module/workflow/workflow.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/layout_preference/controller/layout_preference.controller.ts +4 -2
- package/src/module/layout_preference/entity/layout_preference.entity.ts +11 -0
- package/src/module/layout_preference/repository/layout_preference.repository.ts +6 -2
- package/src/module/layout_preference/service/layout_preference.service.ts +24 -6
- package/src/module/meta/controller/media.controller.ts +5 -7
- package/src/module/workflow/controller/action-category.controller.ts +35 -0
- package/src/module/workflow/controller/action.controller.ts +2 -2
- package/src/module/workflow/controller/comm-template.controller.ts +5 -4
- package/src/module/workflow/controller/workflow-meta.controller.ts +52 -0
- package/src/module/workflow/controller/workflow.controller.ts +14 -0
- package/src/module/workflow/entity/action-category.entity.ts +3 -0
- package/src/module/workflow/entity/action.entity.ts +3 -3
- package/src/module/workflow/entity/comm-template.entity.ts +18 -1
- package/src/module/workflow/entity/stage-movement-data.entity.ts +6 -0
- package/src/module/workflow/entity/template-attach-mapper.entity.ts +30 -0
- package/src/module/workflow/repository/comm-template.repository.ts +58 -5
- package/src/module/workflow/service/action-category.service.ts +26 -1
- package/src/module/workflow/service/action-template-mapping.service.ts +1 -1
- package/src/module/workflow/service/action.service.ts +103 -24
- package/src/module/workflow/service/comm-template.service.ts +54 -1
- package/src/module/workflow/service/populate-workflow.service.ts +189 -0
- package/src/module/workflow/service/workflow-list-master.service.ts +3 -3
- package/src/module/workflow/service/workflow-meta.service.ts +98 -0
- package/src/module/workflow/workflow.module.ts +41 -27
|
@@ -0,0 +1,124 @@
|
|
|
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.PopulateWorkflowService = void 0;
|
|
16
|
+
const typeorm_1 = require("typeorm");
|
|
17
|
+
const populate_meta_service_1 = require("./../../meta/service/populate-meta.service");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
|
|
20
|
+
const workflow_service_1 = require("./workflow.service");
|
|
21
|
+
const stage_group_service_1 = require("./stage-group.service");
|
|
22
|
+
const stage_service_1 = require("./stage.service");
|
|
23
|
+
const action_service_1 = require("./action.service");
|
|
24
|
+
let PopulateWorkflowService = class PopulateWorkflowService extends entity_service_impl_service_1.EntityServiceImpl {
|
|
25
|
+
constructor(populateMetaService, dataSource, workflowService, stageGroupService, stageService, actionService) {
|
|
26
|
+
super();
|
|
27
|
+
this.populateMetaService = populateMetaService;
|
|
28
|
+
this.dataSource = dataSource;
|
|
29
|
+
this.workflowService = workflowService;
|
|
30
|
+
this.stageGroupService = stageGroupService;
|
|
31
|
+
this.stageService = stageService;
|
|
32
|
+
this.actionService = actionService;
|
|
33
|
+
}
|
|
34
|
+
async populateWorkflowData(organization_id, loggedInUser) {
|
|
35
|
+
const workflowTables = [
|
|
36
|
+
{ table: 'cr_workflow', entityType: 'WRFW', service: 'workflowService' },
|
|
37
|
+
{
|
|
38
|
+
table: 'cr_wf_stage_group',
|
|
39
|
+
entityType: 'STGP',
|
|
40
|
+
service: 'stageGroupService',
|
|
41
|
+
},
|
|
42
|
+
{ table: 'cr_wf_stage', entityType: 'STG', service: 'stageService' },
|
|
43
|
+
{ table: 'cr_wf_action', entityType: 'ACTN', service: 'actionService' },
|
|
44
|
+
];
|
|
45
|
+
const getAllFactoryData = async (table) => this.dataSource.query(`SELECT * FROM ${table.table} WHERE organization_id = -1 AND level_type = 'ORG' AND level_id = -1`);
|
|
46
|
+
const factoryData = await Promise.all(workflowTables.map(getAllFactoryData));
|
|
47
|
+
const [workflows, stageGroups, stages, actions] = factoryData;
|
|
48
|
+
const workflowIdMap = {};
|
|
49
|
+
for (const row of workflows) {
|
|
50
|
+
const { id, ...rest } = row;
|
|
51
|
+
const newWf = await this.workflowService.createEntity({
|
|
52
|
+
...rest,
|
|
53
|
+
organization_id,
|
|
54
|
+
level_id: organization_id,
|
|
55
|
+
entity_type: 'WRFW',
|
|
56
|
+
}, loggedInUser);
|
|
57
|
+
workflowIdMap[id] = newWf.id;
|
|
58
|
+
}
|
|
59
|
+
const stageGroupIdMap = {};
|
|
60
|
+
const stageGroupToWorkflowMap = {};
|
|
61
|
+
for (const row of stageGroups) {
|
|
62
|
+
const { id, workflow_id, ...rest } = row;
|
|
63
|
+
const newSg = await this.stageGroupService.createEntity({
|
|
64
|
+
...rest,
|
|
65
|
+
workflow_id: workflowIdMap[workflow_id],
|
|
66
|
+
organization_id,
|
|
67
|
+
level_id: organization_id,
|
|
68
|
+
entity_type: 'STGP',
|
|
69
|
+
}, loggedInUser);
|
|
70
|
+
stageGroupIdMap[id] = newSg.id;
|
|
71
|
+
stageGroupToWorkflowMap[id] = workflow_id;
|
|
72
|
+
}
|
|
73
|
+
const stageIdMap = {};
|
|
74
|
+
const stageToStageGroupMap = {};
|
|
75
|
+
for (const row of stages) {
|
|
76
|
+
const { id, stage_group_id, ...rest } = row;
|
|
77
|
+
const originalWorkflowId = stageGroupToWorkflowMap[stage_group_id];
|
|
78
|
+
const newStage = await this.stageService.createEntity({
|
|
79
|
+
...rest,
|
|
80
|
+
stage_group_id: stageGroupIdMap[stage_group_id],
|
|
81
|
+
workflow_id: workflowIdMap[originalWorkflowId],
|
|
82
|
+
organization_id,
|
|
83
|
+
level_id: organization_id,
|
|
84
|
+
entity_type: 'STG',
|
|
85
|
+
}, loggedInUser);
|
|
86
|
+
stageIdMap[id] = newStage.id;
|
|
87
|
+
stageToStageGroupMap[id] = stage_group_id;
|
|
88
|
+
}
|
|
89
|
+
for (const row of actions) {
|
|
90
|
+
const { id, stage_id, created_date, modified_date, ...rest } = row;
|
|
91
|
+
const newStageId = stageIdMap[stage_id];
|
|
92
|
+
const oldStageGroupId = stageToStageGroupMap[stage_id];
|
|
93
|
+
const oldWorkflowId = stageGroupToWorkflowMap[oldStageGroupId];
|
|
94
|
+
const newWorkflowId = workflowIdMap[oldWorkflowId];
|
|
95
|
+
await this.actionService.createEntity({
|
|
96
|
+
...rest,
|
|
97
|
+
stage_id: newStageId,
|
|
98
|
+
workflow_id: newWorkflowId,
|
|
99
|
+
organization_id,
|
|
100
|
+
level_id: organization_id,
|
|
101
|
+
entity_type: 'ACTN',
|
|
102
|
+
}, loggedInUser);
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
message: 'Workflow data populated successfully',
|
|
106
|
+
status: 'success',
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.PopulateWorkflowService = PopulateWorkflowService;
|
|
111
|
+
exports.PopulateWorkflowService = PopulateWorkflowService = __decorate([
|
|
112
|
+
(0, common_1.Injectable)(),
|
|
113
|
+
__param(2, (0, common_1.Inject)('WorkflowService')),
|
|
114
|
+
__param(3, (0, common_1.Inject)('StageGroupService')),
|
|
115
|
+
__param(4, (0, common_1.Inject)('StageService')),
|
|
116
|
+
__param(5, (0, common_1.Inject)('ActionService')),
|
|
117
|
+
__metadata("design:paramtypes", [populate_meta_service_1.PopulateMetaService,
|
|
118
|
+
typeorm_1.DataSource,
|
|
119
|
+
workflow_service_1.WorkflowService,
|
|
120
|
+
stage_group_service_1.StageGroupService,
|
|
121
|
+
stage_service_1.StageService,
|
|
122
|
+
action_service_1.ActionService])
|
|
123
|
+
], PopulateWorkflowService);
|
|
124
|
+
//# sourceMappingURL=populate-workflow.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populate-workflow.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/populate-workflow.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,sFAAiF;AACjF,2CAAoD;AACpD,gGAAwF;AACxF,yDAAqD;AAErD,+DAA0D;AAC1D,mDAA+C;AAC/C,qDAAiD;AAG1C,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,+CAAiB;IAC5D,YACmB,mBAAwC,EACxC,UAAsB,EAEtB,eAAgC,EAEhC,iBAAoC,EAEpC,YAA0B,EAE1B,aAA4B;QAE7C,KAAK,EAAE,CAAC;QAXS,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,eAAU,GAAV,UAAU,CAAY;QAEtB,oBAAe,GAAf,eAAe,CAAiB;QAEhC,sBAAiB,GAAjB,iBAAiB,CAAmB;QAEpC,iBAAY,GAAZ,YAAY,CAAc;QAE1B,kBAAa,GAAb,aAAa,CAAe;IAG/C,CAAC;IAwDD,KAAK,CAAC,oBAAoB,CAAC,eAAuB,EAAE,YAAsB;QACxE,MAAM,cAAc,GAAG;YACrB,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE;YACxE;gBACE,KAAK,EAAE,mBAAmB;gBAC1B,UAAU,EAAE,MAAM;gBAClB,OAAO,EAAE,mBAAmB;aAC7B;YACD,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE;YACpE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;gBACE,GAAG,IAAI;gBACP,QAAQ,EAAE,UAAU;gBACpB,WAAW,EAAE,aAAa;gBAC1B,eAAe;gBACf,QAAQ,EAAE,eAAe;gBACzB,WAAW,EAAE,MAAM;aACpB,EACD,YAAY,CACb,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE,sCAAsC;YAC/C,MAAM,EAAE,SAAS;SAClB,CAAC;IACJ,CAAC;CACF,CAAA;AAjLY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;IAEzB,WAAA,IAAA,eAAM,EAAC,mBAAmB,CAAC,CAAA;IAE3B,WAAA,IAAA,eAAM,EAAC,cAAc,CAAC,CAAA;IAEtB,WAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;qCARc,2CAAmB;QAC5B,oBAAU;QAEL,kCAAe;QAEb,uCAAiB;QAEtB,4BAAY;QAEX,8BAAa;GAXpC,uBAAuB,CAiLnC"}
|
|
@@ -21,8 +21,8 @@ let WorkflowListMasterService = class WorkflowListMasterService extends entity_s
|
|
|
21
21
|
async getActionCategoryListByStageId(stageId) {
|
|
22
22
|
const results = await this.dataSource.query(`
|
|
23
23
|
SELECT
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
@@ -31,8 +31,8 @@ let WorkflowListMasterService = class WorkflowListMasterService extends entity_s
|
|
|
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,9 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { StageMovementData } from '../entity/stage-movement-data.entity';
|
|
3
|
+
export declare class WorkflowMetaService {
|
|
4
|
+
private readonly stageMovementRepo;
|
|
5
|
+
constructor(stageMovementRepo: Repository<StageMovementData>);
|
|
6
|
+
getCurrentStage(mapped_entity_type: string, mapped_entity_id: number): Promise<StageMovementData | null>;
|
|
7
|
+
getNextStage(currentStage: StageMovementData): Promise<number | null>;
|
|
8
|
+
moveToNextStage(mapped_entity_type: string, mapped_entity_id: number, current_user_id: number): Promise<string>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
let WorkflowMetaService = class WorkflowMetaService {
|
|
21
|
+
constructor(stageMovementRepo) {
|
|
22
|
+
this.stageMovementRepo = stageMovementRepo;
|
|
23
|
+
}
|
|
24
|
+
async getCurrentStage(mapped_entity_type, mapped_entity_id) {
|
|
25
|
+
return this.stageMovementRepo.findOne({
|
|
26
|
+
where: {
|
|
27
|
+
mapped_entity_type,
|
|
28
|
+
mapped_entity_id,
|
|
29
|
+
is_current: 'Y',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async getNextStage(currentStage) {
|
|
34
|
+
const nextStageId = currentStage.stage_action_mapping_id + 1;
|
|
35
|
+
const hasNext = true;
|
|
36
|
+
return hasNext ? nextStageId : null;
|
|
37
|
+
}
|
|
38
|
+
async moveToNextStage(mapped_entity_type, mapped_entity_id, current_user_id) {
|
|
39
|
+
const now = new Date();
|
|
40
|
+
const currentStage = await this.getCurrentStage(mapped_entity_type, mapped_entity_id);
|
|
41
|
+
if (!currentStage) {
|
|
42
|
+
const firstStageId = 1;
|
|
43
|
+
await this.stageMovementRepo.save({
|
|
44
|
+
mapped_entity_type,
|
|
45
|
+
mapped_entity_id,
|
|
46
|
+
current_user_id,
|
|
47
|
+
stage_action_mapping_id: firstStageId,
|
|
48
|
+
start_date: now,
|
|
49
|
+
is_current: 'Y',
|
|
50
|
+
});
|
|
51
|
+
return 'Workflow started with the first stage.';
|
|
52
|
+
}
|
|
53
|
+
const nextStageId = await this.getNextStage(currentStage);
|
|
54
|
+
if (nextStageId) {
|
|
55
|
+
currentStage.end_date = now;
|
|
56
|
+
currentStage.is_current = 'N';
|
|
57
|
+
await this.stageMovementRepo.save(currentStage);
|
|
58
|
+
await this.stageMovementRepo.save({
|
|
59
|
+
entity_type: 'STAGE_MOVEMENT_DATA',
|
|
60
|
+
mapped_entity_type,
|
|
61
|
+
mapped_entity_id,
|
|
62
|
+
current_user_id,
|
|
63
|
+
stage_action_mapping_id: nextStageId,
|
|
64
|
+
start_date: now,
|
|
65
|
+
is_current: 'Y',
|
|
66
|
+
});
|
|
67
|
+
return `Moved to next stage (Stage ID: ${nextStageId}).`;
|
|
68
|
+
}
|
|
69
|
+
currentStage.end_date = now;
|
|
70
|
+
currentStage.is_current = 'N';
|
|
71
|
+
await this.stageMovementRepo.save(currentStage);
|
|
72
|
+
return 'Workflow completed. No next stage available.';
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.WorkflowMetaService = WorkflowMetaService;
|
|
76
|
+
exports.WorkflowMetaService = WorkflowMetaService = __decorate([
|
|
77
|
+
(0, common_1.Injectable)(),
|
|
78
|
+
__param(0, (0, typeorm_1.InjectRepository)(stage_movement_data_entity_1.StageMovementData)),
|
|
79
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
80
|
+
], WorkflowMetaService);
|
|
81
|
+
//# 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":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AACrC,qFAAyE;AAGlE,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YAEmB,iBAAgD;QAAhD,sBAAiB,GAAjB,iBAAiB,CAA+B;IAChE,CAAC;IAKJ,KAAK,CAAC,eAAe,CACnB,kBAA0B,EAC1B,gBAAwB;QAExB,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;YACpC,KAAK,EAAE;gBACL,kBAAkB;gBAClB,gBAAgB;gBAChB,UAAU,EAAE,GAAG;aAChB;SACF,CAAC,CAAC;IACL,CAAC;IAMD,KAAK,CAAC,YAAY,CAAC,YAA+B;QAEhD,MAAM,WAAW,GAAG,YAAY,CAAC,uBAAuB,GAAG,CAAC,CAAC;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G,GAAG,CAAC;QAC9B,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEhD,OAAO,8CAA8C,CAAC;IACxD,CAAC;CACF,CAAA;AA3FY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,8CAAiB,CAAC,CAAA;qCACA,oBAAU;GAHrC,mBAAmB,CA2F/B"}
|
|
@@ -8,40 +8,46 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.WorkflowModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
const workflow_entity_1 = require("./entity/workflow.entity");
|
|
12
|
-
const workflow_service_1 = require("./service/workflow.service");
|
|
13
|
-
const stage_group_entity_1 = require("./entity/stage-group.entity");
|
|
14
|
-
const stage_entity_1 = require("./entity/stage.entity");
|
|
15
|
-
const action_category_entity_1 = require("./entity/action-category.entity");
|
|
16
|
-
const comm_template_entity_1 = require("./entity/comm-template.entity");
|
|
17
|
-
const action_template_mapping_entity_1 = require("./entity/action-template-mapping.entity");
|
|
18
|
-
const stage_action_mapping_entity_1 = require("./entity/stage-action-mapping.entity");
|
|
19
|
-
const action_category_service_1 = require("./service/action-category.service");
|
|
20
|
-
const comm_template_service_1 = require("./service/comm-template.service");
|
|
21
|
-
const stage_action_mapping_service_1 = require("./service/stage-action-mapping.service");
|
|
22
|
-
const action_template_mapping_service_1 = require("./service/action-template-mapping.service");
|
|
23
|
-
const action_service_1 = require("./service/action.service");
|
|
24
|
-
const stage_service_1 = require("./service/stage.service");
|
|
25
|
-
const stage_group_service_1 = require("./service/stage-group.service");
|
|
26
11
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
12
|
+
const listmaster_module_1 = require("../listmaster/listmaster.module");
|
|
27
13
|
const entity_module_1 = require("../meta/entity.module");
|
|
28
|
-
const workflow_list_master_service_1 = require("./service/workflow-list-master.service");
|
|
29
|
-
const workflow_list_master_controller_1 = require("./controller/workflow-list-master.controller");
|
|
30
14
|
const action_template_mapping_controller_1 = require("./controller/action-template-mapping.controller");
|
|
31
|
-
const
|
|
32
|
-
const workflow_repository_1 = require("./repository/workflow.repository");
|
|
33
|
-
const listmaster_module_1 = require("../listmaster/listmaster.module");
|
|
15
|
+
const action_controller_1 = require("./controller/action.controller");
|
|
34
16
|
const comm_template_controller_1 = require("./controller/comm-template.controller");
|
|
35
|
-
const
|
|
36
|
-
const action_entity_1 = require("./entity/action.entity");
|
|
37
|
-
const stage_group_repository_1 = require("./repository/stage-group.repository");
|
|
17
|
+
const entity_modification_controller_1 = require("./controller/entity-modification.controller");
|
|
38
18
|
const stage_group_controller_1 = require("./controller/stage-group.controller");
|
|
39
19
|
const stage_controller_1 = require("./controller/stage.controller");
|
|
20
|
+
const workflow_list_master_controller_1 = require("./controller/workflow-list-master.controller");
|
|
21
|
+
const workflow_meta_controller_1 = require("./controller/workflow-meta.controller");
|
|
22
|
+
const workflow_controller_1 = require("./controller/workflow.controller");
|
|
23
|
+
const action_category_entity_1 = require("./entity/action-category.entity");
|
|
24
|
+
const action_template_mapping_entity_1 = require("./entity/action-template-mapping.entity");
|
|
25
|
+
const action_entity_1 = require("./entity/action.entity");
|
|
26
|
+
const comm_template_entity_1 = require("./entity/comm-template.entity");
|
|
27
|
+
const entity_modification_entity_1 = require("./entity/entity-modification.entity");
|
|
28
|
+
const stage_action_mapping_entity_1 = require("./entity/stage-action-mapping.entity");
|
|
29
|
+
const stage_group_entity_1 = require("./entity/stage-group.entity");
|
|
30
|
+
const stage_movement_data_entity_1 = require("./entity/stage-movement-data.entity");
|
|
31
|
+
const stage_entity_1 = require("./entity/stage.entity");
|
|
32
|
+
const template_attach_mapper_entity_1 = require("./entity/template-attach-mapper.entity");
|
|
33
|
+
const workflow_entity_1 = require("./entity/workflow.entity");
|
|
34
|
+
const comm_template_repository_1 = require("./repository/comm-template.repository");
|
|
35
|
+
const stage_group_repository_1 = require("./repository/stage-group.repository");
|
|
40
36
|
const stage_repository_1 = require("./repository/stage.repository");
|
|
41
|
-
const
|
|
37
|
+
const workflow_repository_1 = require("./repository/workflow.repository");
|
|
38
|
+
const action_category_service_1 = require("./service/action-category.service");
|
|
39
|
+
const action_template_mapping_service_1 = require("./service/action-template-mapping.service");
|
|
40
|
+
const action_service_1 = require("./service/action.service");
|
|
41
|
+
const comm_template_service_1 = require("./service/comm-template.service");
|
|
42
42
|
const entity_modification_service_1 = require("./service/entity-modification.service");
|
|
43
|
-
const
|
|
44
|
-
const
|
|
43
|
+
const populate_workflow_service_1 = require("./service/populate-workflow.service");
|
|
44
|
+
const stage_action_mapping_service_1 = require("./service/stage-action-mapping.service");
|
|
45
|
+
const stage_group_service_1 = require("./service/stage-group.service");
|
|
46
|
+
const stage_service_1 = require("./service/stage.service");
|
|
47
|
+
const workflow_list_master_service_1 = require("./service/workflow-list-master.service");
|
|
48
|
+
const workflow_meta_service_1 = require("./service/workflow-meta.service");
|
|
49
|
+
const workflow_service_1 = require("./service/workflow.service");
|
|
50
|
+
const action_category_controller_1 = require("./controller/action-category.controller");
|
|
45
51
|
let WorkflowModule = class WorkflowModule {
|
|
46
52
|
};
|
|
47
53
|
exports.WorkflowModule = WorkflowModule;
|
|
@@ -57,7 +63,9 @@ exports.WorkflowModule = WorkflowModule = __decorate([
|
|
|
57
63
|
comm_template_entity_1.CommTemplate,
|
|
58
64
|
action_template_mapping_entity_1.ActionTemplateMapping,
|
|
59
65
|
stage_action_mapping_entity_1.StageActionMapping,
|
|
66
|
+
stage_movement_data_entity_1.StageMovementData,
|
|
60
67
|
entity_modification_entity_1.EntityModification,
|
|
68
|
+
template_attach_mapper_entity_1.TemplateAttach,
|
|
61
69
|
]),
|
|
62
70
|
entity_module_1.EntityModule,
|
|
63
71
|
listmaster_module_1.ListMasterModule,
|
|
@@ -84,6 +92,9 @@ exports.WorkflowModule = WorkflowModule = __decorate([
|
|
|
84
92
|
comm_template_repository_1.CommTemplateRepository,
|
|
85
93
|
stage_group_repository_1.StageGroupRepository,
|
|
86
94
|
stage_repository_1.StageRepository,
|
|
95
|
+
workflow_service_1.WorkflowService,
|
|
96
|
+
workflow_meta_service_1.WorkflowMetaService,
|
|
97
|
+
populate_workflow_service_1.PopulateWorkflowService,
|
|
87
98
|
],
|
|
88
99
|
exports: [
|
|
89
100
|
'ActionCategoryService',
|
|
@@ -96,6 +107,8 @@ exports.WorkflowModule = WorkflowModule = __decorate([
|
|
|
96
107
|
workflow_repository_1.WorkflowRepository,
|
|
97
108
|
stage_group_repository_1.StageGroupRepository,
|
|
98
109
|
stage_repository_1.StageRepository,
|
|
110
|
+
workflow_meta_service_1.WorkflowMetaService,
|
|
111
|
+
populate_workflow_service_1.PopulateWorkflowService,
|
|
99
112
|
],
|
|
100
113
|
controllers: [
|
|
101
114
|
workflow_list_master_controller_1.WorkflowListMasterController,
|
|
@@ -105,7 +118,9 @@ exports.WorkflowModule = WorkflowModule = __decorate([
|
|
|
105
118
|
stage_group_controller_1.StageGroupController,
|
|
106
119
|
stage_controller_1.StageController,
|
|
107
120
|
action_controller_1.ActionController,
|
|
121
|
+
workflow_meta_controller_1.WorkflowMetaController,
|
|
108
122
|
entity_modification_controller_1.EntityModificationController,
|
|
123
|
+
action_category_controller_1.ActionCategoryController,
|
|
109
124
|
],
|
|
110
125
|
})
|
|
111
126
|
], WorkflowModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.module.js","sourceRoot":"","sources":["../../../src/module/workflow/workflow.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"workflow.module.js","sourceRoot":"","sources":["../../../src/module/workflow/workflow.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,uEAAmE;AACnE,yDAAqD;AACrD,wGAAkG;AAClG,sEAAkE;AAClE,oFA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