rez_core 2.1.145 → 2.1.147
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 +1 -1
- package/dist/module/workflow/entity/action.entity.js +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 +20 -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 +58 -10
- 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 +1 -1
- 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 +23 -1
- package/src/module/workflow/service/action-template-mapping.service.ts +1 -1
- package/src/module/workflow/service/action.service.ts +86 -10
- 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,54 @@
|
|
|
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.TemplateAttach = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
let TemplateAttach = class TemplateAttach {
|
|
15
|
+
constructor() { }
|
|
16
|
+
};
|
|
17
|
+
exports.TemplateAttach = TemplateAttach;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], TemplateAttach.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.Column)({}),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], TemplateAttach.prototype, "entity_type", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
28
|
+
__metadata("design:type", Number)
|
|
29
|
+
], TemplateAttach.prototype, "template_id", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
32
|
+
__metadata("design:type", Number)
|
|
33
|
+
], TemplateAttach.prototype, "media_id", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], TemplateAttach.prototype, "organization_id", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], TemplateAttach.prototype, "appcode", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], TemplateAttach.prototype, "level_id", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], TemplateAttach.prototype, "level_type", void 0);
|
|
50
|
+
exports.TemplateAttach = TemplateAttach = __decorate([
|
|
51
|
+
(0, typeorm_1.Entity)({ name: 'cr_wf_tem_attach_mapper' }),
|
|
52
|
+
__metadata("design:paramtypes", [])
|
|
53
|
+
], TemplateAttach);
|
|
54
|
+
//# sourceMappingURL=template-attach-mapper.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-attach-mapper.entity.js","sourceRoot":"","sources":["../../../../src/module/workflow/entity/template-attach-mapper.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiE;AAG1D,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,gBAAe,CAAC;CAyBjB,CAAA;AA1BY,wCAAc;AAIzB;IADC,IAAA,gCAAsB,GAAE;;0CACd;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,CAAC;;mDACS;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACP;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACH;AAGxB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACX;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACR;yBAzBR,cAAc;IAD1B,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,yBAAyB,EAAE,CAAC;;GAC/B,cAAc,CA0B1B"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Repository } from 'typeorm';
|
|
2
2
|
import { CommTemplate } from '../entity/comm-template.entity';
|
|
3
|
+
import { TemplateAttach } from '../entity/template-attach-mapper.entity';
|
|
4
|
+
import { MediaDataService } from 'src/module/meta/service/media-data.service';
|
|
3
5
|
export declare class CommTemplateRepository {
|
|
4
6
|
private readonly commTemplateRepository;
|
|
5
|
-
|
|
7
|
+
private readonly templateAttachEntity;
|
|
8
|
+
private readonly mediaDataService;
|
|
9
|
+
constructor(commTemplateRepository: Repository<CommTemplate>, templateAttachEntity: Repository<TemplateAttach>, mediaDataService: MediaDataService);
|
|
6
10
|
getAllCommTemplate(entity_type: string, loggedInUser: any): Promise<CommTemplate[]>;
|
|
7
|
-
|
|
11
|
+
save(commTemplate: any): Promise<any>;
|
|
12
|
+
delete(id: any): Promise<any>;
|
|
13
|
+
getTemplateByCode(entity_type: string, code: string, loggedInUser: any): Promise<any | null>;
|
|
8
14
|
}
|
|
@@ -17,35 +17,66 @@ const common_1 = require("@nestjs/common");
|
|
|
17
17
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
18
|
const typeorm_2 = require("typeorm");
|
|
19
19
|
const comm_template_entity_1 = require("../entity/comm-template.entity");
|
|
20
|
+
const template_attach_mapper_entity_1 = require("../entity/template-attach-mapper.entity");
|
|
21
|
+
const media_data_service_1 = require("../../meta/service/media-data.service");
|
|
20
22
|
let CommTemplateRepository = class CommTemplateRepository {
|
|
21
|
-
constructor(commTemplateRepository) {
|
|
23
|
+
constructor(commTemplateRepository, templateAttachEntity, mediaDataService) {
|
|
22
24
|
this.commTemplateRepository = commTemplateRepository;
|
|
25
|
+
this.templateAttachEntity = templateAttachEntity;
|
|
26
|
+
this.mediaDataService = mediaDataService;
|
|
23
27
|
}
|
|
24
28
|
async getAllCommTemplate(entity_type, loggedInUser) {
|
|
29
|
+
const { organization_id } = loggedInUser;
|
|
25
30
|
return this.commTemplateRepository.find({
|
|
26
31
|
select: ['name', 'code'],
|
|
27
32
|
where: {
|
|
28
|
-
|
|
33
|
+
mapped_entity_type: entity_type,
|
|
34
|
+
organization_id: organization_id,
|
|
29
35
|
},
|
|
30
36
|
});
|
|
31
37
|
}
|
|
38
|
+
async save(commTemplate) {
|
|
39
|
+
return this.templateAttachEntity.save(commTemplate);
|
|
40
|
+
}
|
|
41
|
+
async delete(id) {
|
|
42
|
+
return await this.templateAttachEntity.delete(id);
|
|
43
|
+
}
|
|
32
44
|
async getTemplateByCode(entity_type, code, loggedInUser) {
|
|
33
45
|
const template = await this.commTemplateRepository.findOne({
|
|
34
46
|
where: {
|
|
35
|
-
entity_type
|
|
36
|
-
code
|
|
47
|
+
entity_type,
|
|
48
|
+
code,
|
|
37
49
|
},
|
|
38
50
|
});
|
|
39
51
|
if (!template) {
|
|
40
52
|
throw new common_1.NotFoundException(`Template with code ${code} not found`);
|
|
41
53
|
}
|
|
42
|
-
|
|
54
|
+
if (template.format_type === 'markup') {
|
|
55
|
+
const media = await this.mediaDataService.getMediaDownloadUrl(template.markup_id, loggedInUser);
|
|
56
|
+
console.log(media);
|
|
57
|
+
}
|
|
58
|
+
if (template.format_type === 'richtext') {
|
|
59
|
+
return template;
|
|
60
|
+
}
|
|
61
|
+
const attachments = await this.templateAttachEntity.find({
|
|
62
|
+
select: ['media_id'],
|
|
63
|
+
where: {
|
|
64
|
+
entity_type: entity_type,
|
|
65
|
+
template_id: template.id,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
const media = await this.mediaDataService.getMediaDownloadUrl(1, loggedInUser);
|
|
69
|
+
console.log(media);
|
|
70
|
+
return { ...template, attachments: attachments.map((att) => att.media_id) };
|
|
43
71
|
}
|
|
44
72
|
};
|
|
45
73
|
exports.CommTemplateRepository = CommTemplateRepository;
|
|
46
74
|
exports.CommTemplateRepository = CommTemplateRepository = __decorate([
|
|
47
75
|
(0, common_1.Injectable)(),
|
|
48
76
|
__param(0, (0, typeorm_1.InjectRepository)(comm_template_entity_1.CommTemplate)),
|
|
49
|
-
|
|
77
|
+
__param(1, (0, typeorm_1.InjectRepository)(template_attach_mapper_entity_1.TemplateAttach)),
|
|
78
|
+
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
79
|
+
typeorm_2.Repository,
|
|
80
|
+
media_data_service_1.MediaDataService])
|
|
50
81
|
], CommTemplateRepository);
|
|
51
82
|
//# sourceMappingURL=comm-template.repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comm-template.repository.js","sourceRoot":"","sources":["../../../../src/module/workflow/repository/comm-template.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+D;AAC/D,6CAAmD;AAEnD,qCAAqC;AACrC,yEAA8D;
|
|
1
|
+
{"version":3,"file":"comm-template.repository.js","sourceRoot":"","sources":["../../../../src/module/workflow/repository/comm-template.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+D;AAC/D,6CAAmD;AAEnD,qCAAqC;AACrC,yEAA8D;AAC9D,2FAAyE;AACzE,8EAA8E;AAGvE,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,YAEmB,sBAAgD,EAEhD,oBAAgD,EAChD,gBAAkC;QAHlC,2BAAsB,GAAtB,sBAAsB,CAA0B;QAEhD,yBAAoB,GAApB,oBAAoB,CAA4B;QAChD,qBAAgB,GAAhB,gBAAgB,CAAkB;IAClD,CAAC;IAEJ,KAAK,CAAC,kBAAkB,CAAC,WAAmB,EAAE,YAAY;QACxD,MAAM,EAAE,eAAe,EAAE,GAAG,YAAY,CAAC;QACzC,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;YACtC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;YACxB,KAAK,EAAE;gBACL,kBAAkB,EAAE,WAAW;gBAC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C;QAEF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,OAAO,EAAE,GAAG,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC9E,CAAC;CACF,CAAA;AApFY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,mCAAY,CAAC,CAAA;IAE9B,WAAA,IAAA,0BAAgB,EAAC,8CAAc,CAAC,CAAA;qCADQ,oBAAU;QAEZ,oBAAU;QACd,qCAAgB;GAN1C,sBAAsB,CAoFlC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
2
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
3
|
+
import { DataSource } from 'typeorm';
|
|
2
4
|
export declare class ActionCategoryService extends EntityServiceImpl {
|
|
5
|
+
private readonly dataSource;
|
|
6
|
+
constructor(dataSource: DataSource);
|
|
7
|
+
getActionsCat(loggedInUser: UserData, entity_type: string): Promise<any>;
|
|
3
8
|
}
|
|
@@ -5,14 +5,33 @@ 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
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.ActionCategoryService = void 0;
|
|
10
13
|
const common_1 = require("@nestjs/common");
|
|
11
14
|
const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
12
16
|
let ActionCategoryService = class ActionCategoryService extends entity_service_impl_service_1.EntityServiceImpl {
|
|
17
|
+
constructor(dataSource) {
|
|
18
|
+
super();
|
|
19
|
+
this.dataSource = dataSource;
|
|
20
|
+
}
|
|
21
|
+
async getActionsCat(loggedInUser, entity_type) {
|
|
22
|
+
const { organization_id } = loggedInUser;
|
|
23
|
+
const result = await this.dataSource.query(`
|
|
24
|
+
SELECT id, name
|
|
25
|
+
FROM cr_wf_action_category
|
|
26
|
+
WHERE mapped_entity_type = ?
|
|
27
|
+
AND organization_id = ?
|
|
28
|
+
`, [entity_type, organization_id]);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
13
31
|
};
|
|
14
32
|
exports.ActionCategoryService = ActionCategoryService;
|
|
15
33
|
exports.ActionCategoryService = ActionCategoryService = __decorate([
|
|
16
|
-
(0, common_1.Injectable)()
|
|
34
|
+
(0, common_1.Injectable)(),
|
|
35
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
17
36
|
], ActionCategoryService);
|
|
18
37
|
//# sourceMappingURL=action-category.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-category.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/action-category.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"action-category.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/action-category.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,gGAAwF;AAExF,qCAAqC;AAG9B,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,+CAAiB;IAC1D,YAA6B,UAAsB;QACjD,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,YAAsB,EAAE,WAAmB;QAC7D,MAAM,EAAE,eAAe,EAAE,GAAG,YAAY,CAAC;QAEzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACxC;;;;;KAKD,EACC,CAAC,WAAW,EAAE,eAAe,CAAC,CAC/B,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AApBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAE8B,oBAAU;GADxC,qBAAqB,CAoBjC"}
|
|
@@ -11,5 +11,5 @@ export declare class ActionService extends EntityServiceImpl {
|
|
|
11
11
|
deleteEntity(entityType: string, id: number, loggedInUser: UserData): Promise<any>;
|
|
12
12
|
getReasonCode(loggedInUser: UserData): Promise<any>;
|
|
13
13
|
defaultReasonCode(list_type: string, loggedInUser: UserData): Promise<any>;
|
|
14
|
-
getActions(loggedInUser: UserData,
|
|
14
|
+
getActions(loggedInUser: UserData, stage_id: number): Promise<any>;
|
|
15
15
|
}
|
|
@@ -115,29 +115,77 @@ let ActionService = class ActionService extends entity_service_impl_service_1.En
|
|
|
115
115
|
value: row.name,
|
|
116
116
|
}));
|
|
117
117
|
}
|
|
118
|
-
async getActions(loggedInUser,
|
|
118
|
+
async getActions(loggedInUser, stage_id) {
|
|
119
119
|
const { organization_id } = loggedInUser;
|
|
120
|
+
const stageActions = await this.dataSource.query(`
|
|
121
|
+
SELECT id, action_id
|
|
122
|
+
FROM cr_wf_stage_action_mapping
|
|
123
|
+
WHERE stage_id = ?
|
|
124
|
+
`, [stage_id]);
|
|
125
|
+
if (!stageActions?.length)
|
|
126
|
+
return [];
|
|
127
|
+
const actionIds = stageActions.map((sa) => sa.action_id);
|
|
128
|
+
const mappingIds = stageActions.map((sa) => sa.id);
|
|
129
|
+
const templateMappings = await this.dataSource.query(`
|
|
130
|
+
SELECT template_code
|
|
131
|
+
FROM cr_wf_action_template_mapping
|
|
132
|
+
WHERE stg_act_mapping_id IN (?)
|
|
133
|
+
`, [mappingIds]);
|
|
134
|
+
const templateCodes = templateMappings.map((tm) => tm.template_code);
|
|
135
|
+
let templateNameMap = {};
|
|
136
|
+
if (templateCodes.length > 0) {
|
|
137
|
+
const templates = await this.dataSource.query(`
|
|
138
|
+
SELECT code, name
|
|
139
|
+
FROM cr_wf_comm_template
|
|
140
|
+
WHERE code IN (?)
|
|
141
|
+
AND organization_id = ?
|
|
142
|
+
`, [templateCodes, organization_id]);
|
|
143
|
+
const codeToNameMap = templates.reduce((acc, curr) => {
|
|
144
|
+
acc[curr.code] = curr.name;
|
|
145
|
+
return acc;
|
|
146
|
+
}, {});
|
|
147
|
+
templateMappings.forEach((tm) => {
|
|
148
|
+
const mappingId = tm.stg_act_mapping_id;
|
|
149
|
+
const name = codeToNameMap[tm.template_code];
|
|
150
|
+
if (name) {
|
|
151
|
+
if (!templateNameMap[mappingId]) {
|
|
152
|
+
templateNameMap[mappingId] = name;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
templateNameMap[mappingId] += `, ${name}`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
120
160
|
const result = await this.dataSource.query(`
|
|
121
161
|
SELECT
|
|
162
|
+
a.id,
|
|
122
163
|
a.name AS action_name,
|
|
123
164
|
ac.name AS action_category,
|
|
124
|
-
ar.name AS action_requirement
|
|
125
|
-
'Email Template' AS template
|
|
126
|
-
|
|
165
|
+
ar.name AS action_requirement
|
|
127
166
|
FROM cr_wf_action a
|
|
128
|
-
|
|
129
167
|
LEFT JOIN cr_wf_action_category ac
|
|
130
168
|
ON ac.id = a.action_cat_id
|
|
131
|
-
|
|
132
169
|
LEFT JOIN cr_list_master_items ar
|
|
133
170
|
ON ar.id = a.action_requirement
|
|
134
171
|
AND ar.listtype = 'ACRQ'
|
|
135
172
|
AND ar.organization_id = ?
|
|
136
|
-
|
|
137
173
|
WHERE a.organization_id = ?
|
|
138
|
-
|
|
139
|
-
`, [organization_id, organization_id,
|
|
140
|
-
|
|
174
|
+
AND a.id IN (?)
|
|
175
|
+
`, [organization_id, organization_id, actionIds]);
|
|
176
|
+
const enrichedResult = result.map((row) => {
|
|
177
|
+
const relatedMappingIds = stageActions
|
|
178
|
+
.filter((sa) => sa.action_id === row.id)
|
|
179
|
+
.map((sa) => sa.id);
|
|
180
|
+
const allNames = relatedMappingIds
|
|
181
|
+
.map((mid) => templateNameMap[mid])
|
|
182
|
+
.filter(Boolean);
|
|
183
|
+
return {
|
|
184
|
+
...row,
|
|
185
|
+
template: allNames.length ? allNames.join(', ') : '',
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
return enrichedResult;
|
|
141
189
|
}
|
|
142
190
|
};
|
|
143
191
|
exports.ActionService = ActionService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/action.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiE;AAEjE,gGAAwF;AAExF,qCAAoD;AAI7C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,+CAAiB;IAClD,YAA6B,UAAsB;QACjD,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,UAAkB,EAClB,EAAU,EACV,YAAY;QAEZ,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;QAE3E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAC1C;iGAC2F,EAC3F,CAAC,UAAU,CAAC,EAAE,CAAC,CAChB,CAAC;QAEF,OAAO,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;I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CACxC;;;;KAID,EACC,CAAC,SAAS,EAAE,eAAe,CAAC,CAC7B,CAAC;QAGF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC;YAC/B,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,KAAK,EAAE,GAAG,CAAC,IAAI;SAChB,CAAC,CAAC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,YAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"action.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/action.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiE;AAEjE,gGAAwF;AAExF,qCAAoD;AAI7C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,+CAAiB;IAClD,YAA6B,UAAsB;QACjD,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,UAAkB,EAClB,EAAU,EACV,YAAY;QAEZ,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;QAE3E,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAC1C;iGAC2F,EAC3F,CAAC,UAAU,CAAC,EAAE,CAAC,CAChB,CAAC;QAEF,OAAO,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,UAAsB,EACtB,YAA6B,EAC7B,OAA8B,EAC9B,OAAgB;QAEhB,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAEtC,IAA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AAO,cAAc,CAAC;IACxB,CAAC;CACF,CAAA;AArTY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAE8B,oBAAU;GADxC,aAAa,CAqTzB"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { CommTemplateRepository } from '../repository/comm-template.repository';
|
|
2
2
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
3
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
3
4
|
export declare class CommTemplateService extends EntityServiceImpl {
|
|
4
5
|
private readonly commTemplateRepository;
|
|
5
6
|
constructor(commTemplateRepository: CommTemplateRepository);
|
|
7
|
+
createEntity(entityData: any, loggedInUser: any): Promise<any>;
|
|
8
|
+
updateEntity(entityData: any, loggedInUser: UserData): Promise<any>;
|
|
6
9
|
getEntityData(entityType: string, id: number, loggedInUser: any): Promise<any>;
|
|
7
10
|
getAllCommTemplate(entity_type: string, loggedInUser: any): Promise<{
|
|
8
|
-
label: string;
|
|
9
11
|
value: string;
|
|
12
|
+
name: string;
|
|
10
13
|
}[]>;
|
|
11
14
|
}
|
|
@@ -18,6 +18,43 @@ let CommTemplateService = class CommTemplateService extends entity_service_impl_
|
|
|
18
18
|
super();
|
|
19
19
|
this.commTemplateRepository = commTemplateRepository;
|
|
20
20
|
}
|
|
21
|
+
async createEntity(entityData, loggedInUser) {
|
|
22
|
+
const { attachments, ...templateData } = entityData;
|
|
23
|
+
const tempData = await super.createEntity(templateData, loggedInUser);
|
|
24
|
+
if (attachments && attachments.length > 0) {
|
|
25
|
+
const attachmentEntities = attachments.map((attachment) => ({
|
|
26
|
+
entity_type: templateData.entity_type,
|
|
27
|
+
template_id: tempData.id,
|
|
28
|
+
media_id: attachment,
|
|
29
|
+
organization_id: loggedInUser.organization_id,
|
|
30
|
+
appcode: loggedInUser.appcode,
|
|
31
|
+
level_id: loggedInUser.level_id,
|
|
32
|
+
level_type: loggedInUser.level_type,
|
|
33
|
+
}));
|
|
34
|
+
await this.commTemplateRepository.save(attachmentEntities);
|
|
35
|
+
}
|
|
36
|
+
return tempData;
|
|
37
|
+
}
|
|
38
|
+
async updateEntity(entityData, loggedInUser) {
|
|
39
|
+
const { attachments, ...templateData } = entityData;
|
|
40
|
+
const tempData = await super.updateEntity(templateData, loggedInUser);
|
|
41
|
+
await this.commTemplateRepository.delete({
|
|
42
|
+
template_id: tempData.id,
|
|
43
|
+
});
|
|
44
|
+
if (attachments && attachments.length > 0) {
|
|
45
|
+
const attachmentEntities = attachments.map((attachment) => ({
|
|
46
|
+
entity_type: templateData.entity_type,
|
|
47
|
+
template_id: tempData.id,
|
|
48
|
+
media_id: attachment,
|
|
49
|
+
organization_id: loggedInUser.organization_id,
|
|
50
|
+
appcode: loggedInUser.appcode,
|
|
51
|
+
level_id: loggedInUser.level_id,
|
|
52
|
+
level_type: loggedInUser.level_type,
|
|
53
|
+
}));
|
|
54
|
+
await this.commTemplateRepository.save(attachmentEntities);
|
|
55
|
+
}
|
|
56
|
+
return tempData;
|
|
57
|
+
}
|
|
21
58
|
async getEntityData(entityType, id, loggedInUser) {
|
|
22
59
|
const getTemplate = await this.commTemplateRepository.getTemplateByCode(entityType, id.toString(), loggedInUser);
|
|
23
60
|
return getTemplate;
|
|
@@ -25,8 +62,8 @@ let CommTemplateService = class CommTemplateService extends entity_service_impl_
|
|
|
25
62
|
async getAllCommTemplate(entity_type, loggedInUser) {
|
|
26
63
|
const commTemplateData = await this.commTemplateRepository.getAllCommTemplate(entity_type, loggedInUser);
|
|
27
64
|
const response = commTemplateData.map((item) => ({
|
|
28
|
-
label: item.name,
|
|
29
65
|
value: item.code,
|
|
66
|
+
name: item.name,
|
|
30
67
|
}));
|
|
31
68
|
return response;
|
|
32
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comm-template.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/comm-template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qFAAgF;AAChF,gGAAwF;
|
|
1
|
+
{"version":3,"file":"comm-template.service.js","sourceRoot":"","sources":["../../../../src/module/workflow/service/comm-template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qFAAgF;AAChF,gGAAwF;AAKjF,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,+CAAiB;IACxD,YAA6B,sBAA8C;QACzE,KAAK,EAAE,CAAC;QADmB,2BAAsB,GAAtB,sBAAsB,CAAwB;IAE3E,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAe,EAAE,YAAiB;QACnD,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,EAAE,GAAG,UAAU,CAAC;QAEpD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAGtE,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,kBAAkB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBAC1D,WAAW,EAAE,YAAY,CAAC,WAAW;gBACrC,WAAW,EAAE,QAAQ,CAAC,EAAE;gBACxB,QAAQ,EAAE,UAAU;gBACpB,eAAe,EAAE,YAAY,CAAC,eAAe;gBAC7C,OAAO,EAAE,YAAY,CAAC,OAAO;gBAC7B,QAAQ,EAAE,YAAY,CAAC,QAAQ;gBAC/B,UAAU,EAAE,YAAY,CAAC,UAAU;aACpC,CAAC,CAAC,CAAC;YAEJ,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAe,EAAE,YAAsB;QACxD,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,EAAE,GAAG,UAAU,CAAC;QAEpD,MAAM,QAAQ,GAAG,M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,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC,CAAC,CAAC;QAEJ,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAtFY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAE0C,iDAAsB;GADhE,mBAAmB,CAsF/B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DataSource } from 'typeorm';
|
|
2
|
+
import { PopulateMetaService } from './../../meta/service/populate-meta.service';
|
|
3
|
+
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
4
|
+
import { WorkflowService } from './workflow.service';
|
|
5
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
6
|
+
import { StageGroupService } from './stage-group.service';
|
|
7
|
+
import { StageService } from './stage.service';
|
|
8
|
+
import { ActionService } from './action.service';
|
|
9
|
+
export declare class PopulateWorkflowService extends EntityServiceImpl {
|
|
10
|
+
private readonly populateMetaService;
|
|
11
|
+
private readonly dataSource;
|
|
12
|
+
private readonly workflowService;
|
|
13
|
+
private readonly stageGroupService;
|
|
14
|
+
private readonly stageService;
|
|
15
|
+
private readonly actionService;
|
|
16
|
+
constructor(populateMetaService: PopulateMetaService, dataSource: DataSource, workflowService: WorkflowService, stageGroupService: StageGroupService, stageService: StageService, actionService: ActionService);
|
|
17
|
+
populateWorkflowData(organization_id: number, loggedInUser: UserData): Promise<{
|
|
18
|
+
message: string;
|
|
19
|
+
status: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
@@ -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,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,M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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
|
+
}
|