rez_core 2.2.31 → 2.2.32
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/workflow/controller/action-category.controller.d.ts +10 -10
- package/dist/module/workflow/controller/action-category.controller.js +11 -16
- package/dist/module/workflow/controller/action-category.controller.js.map +1 -1
- package/dist/module/workflow/controller/task.controller.d.ts +9 -0
- package/dist/module/workflow/controller/task.controller.js +14 -0
- package/dist/module/workflow/controller/task.controller.js.map +1 -1
- package/dist/module/workflow/entity/task-data.entity.js +1 -1
- package/dist/module/workflow/entity/task-data.entity.js.map +1 -1
- package/dist/module/workflow/repository/action-category.repository.d.ts +18 -0
- package/dist/module/workflow/repository/action-category.repository.js +67 -0
- package/dist/module/workflow/repository/action-category.repository.js.map +1 -0
- package/dist/module/workflow/repository/action.repository.d.ts +4 -0
- package/dist/module/workflow/repository/action.repository.js +104 -0
- package/dist/module/workflow/repository/action.repository.js.map +1 -1
- package/dist/module/workflow/service/action-category.service.d.ts +12 -5
- package/dist/module/workflow/service/action-category.service.js +10 -30
- package/dist/module/workflow/service/action-category.service.js.map +1 -1
- package/dist/module/workflow/service/action.service.js +3 -98
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/task.service.d.ts +11 -1
- package/dist/module/workflow/service/task.service.js +48 -2
- package/dist/module/workflow/service/task.service.js.map +1 -1
- package/dist/module/workflow/workflow.module.js +4 -0
- 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/workflow/controller/action-category.controller.ts +4 -19
- package/src/module/workflow/controller/task.controller.ts +18 -0
- package/src/module/workflow/entity/task-data.entity.ts +1 -1
- package/src/module/workflow/repository/action-category.repository.ts +56 -0
- package/src/module/workflow/repository/action.repository.ts +151 -0
- package/src/module/workflow/service/action-category.service.ts +11 -42
- package/src/module/workflow/service/action.service.ts +3 -141
- package/src/module/workflow/service/task.service.ts +80 -0
- package/src/module/workflow/workflow.module.ts +4 -0
|
@@ -2,16 +2,16 @@ import { ActionCategoryService } from '../service/action-category.service';
|
|
|
2
2
|
export declare class ActionCategoryController {
|
|
3
3
|
private readonly actionCategoryService;
|
|
4
4
|
constructor(actionCategoryService: ActionCategoryService);
|
|
5
|
-
getActionsCat(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, action_cat_code: string): Promise<{
|
|
5
|
+
getActionsCat(entity_type: string): Promise<{
|
|
6
|
+
label: any;
|
|
7
|
+
value: string;
|
|
8
|
+
}[]>;
|
|
9
|
+
getReasonCodeByActionCategoryId(action_cat_code: string): Promise<{
|
|
11
10
|
success: boolean;
|
|
12
|
-
value:
|
|
11
|
+
value: null;
|
|
12
|
+
} | {
|
|
13
|
+
success: boolean;
|
|
14
|
+
value: string;
|
|
13
15
|
}>;
|
|
14
|
-
getActionCategory(
|
|
15
|
-
user: any;
|
|
16
|
-
}, action_cat_id: number): Promise<any>;
|
|
16
|
+
getActionCategory(action_cat_id: number): Promise<any[]>;
|
|
17
17
|
}
|
|
@@ -20,18 +20,16 @@ let ActionCategoryController = class ActionCategoryController {
|
|
|
20
20
|
constructor(actionCategoryService) {
|
|
21
21
|
this.actionCategoryService = actionCategoryService;
|
|
22
22
|
}
|
|
23
|
-
async getActionsCat(
|
|
24
|
-
const
|
|
25
|
-
const result = this.actionCategoryService.getActionsCat(loggedInUser, entity_type);
|
|
23
|
+
async getActionsCat(entity_type) {
|
|
24
|
+
const result = this.actionCategoryService.getActionsCat(entity_type);
|
|
26
25
|
return result;
|
|
27
26
|
}
|
|
28
|
-
async getReasonCodeByActionCategoryId(
|
|
27
|
+
async getReasonCodeByActionCategoryId(action_cat_code) {
|
|
29
28
|
const result = this.actionCategoryService.getReasonCodeByActionCategoryId(action_cat_code);
|
|
30
29
|
return result;
|
|
31
30
|
}
|
|
32
|
-
async getActionCategory(
|
|
33
|
-
const
|
|
34
|
-
const result = this.actionCategoryService.getActionCategory(loggedInUser, action_cat_id);
|
|
31
|
+
async getActionCategory(action_cat_id) {
|
|
32
|
+
const result = this.actionCategoryService.getActionCategory(action_cat_id);
|
|
35
33
|
return result;
|
|
36
34
|
}
|
|
37
35
|
};
|
|
@@ -39,28 +37,25 @@ exports.ActionCategoryController = ActionCategoryController;
|
|
|
39
37
|
__decorate([
|
|
40
38
|
(0, common_1.Post)('/getActionsCategory'),
|
|
41
39
|
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
42
|
-
__param(0, (0, common_1.
|
|
43
|
-
__param(1, (0, common_1.Body)('entity_type')),
|
|
40
|
+
__param(0, (0, common_1.Body)('entity_type')),
|
|
44
41
|
__metadata("design:type", Function),
|
|
45
|
-
__metadata("design:paramtypes", [
|
|
42
|
+
__metadata("design:paramtypes", [String]),
|
|
46
43
|
__metadata("design:returntype", Promise)
|
|
47
44
|
], ActionCategoryController.prototype, "getActionsCat", null);
|
|
48
45
|
__decorate([
|
|
49
46
|
(0, common_1.Post)('/getreasoncode'),
|
|
50
47
|
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
51
|
-
__param(0, (0, common_1.
|
|
52
|
-
__param(1, (0, common_1.Body)('action_cat_code')),
|
|
48
|
+
__param(0, (0, common_1.Body)('action_cat_code')),
|
|
53
49
|
__metadata("design:type", Function),
|
|
54
|
-
__metadata("design:paramtypes", [
|
|
50
|
+
__metadata("design:paramtypes", [String]),
|
|
55
51
|
__metadata("design:returntype", Promise)
|
|
56
52
|
], ActionCategoryController.prototype, "getReasonCodeByActionCategoryId", null);
|
|
57
53
|
__decorate([
|
|
58
54
|
(0, common_1.Post)('/getactioncategorydata'),
|
|
59
55
|
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
60
|
-
__param(0, (0, common_1.
|
|
61
|
-
__param(1, (0, common_1.Body)('action_cat_id')),
|
|
56
|
+
__param(0, (0, common_1.Body)('action_cat_id')),
|
|
62
57
|
__metadata("design:type", Function),
|
|
63
|
-
__metadata("design:paramtypes", [
|
|
58
|
+
__metadata("design:paramtypes", [Number]),
|
|
64
59
|
__metadata("design:returntype", Promise)
|
|
65
60
|
], ActionCategoryController.prototype, "getActionCategory", null);
|
|
66
61
|
exports.ActionCategoryController = ActionCategoryController = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-category.controller.js","sourceRoot":"","sources":["../../../../src/module/workflow/controller/action-category.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,2DAAgE;AAChE,gFAA2E;AAIpE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAEmB,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;IAC5D,CAAC;IAIE,AAAN,KAAK,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"action-category.controller.js","sourceRoot":"","sources":["../../../../src/module/workflow/controller/action-category.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,2DAAgE;AAChE,gFAA2E;AAIpE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAEmB,qBAA4C;QAA5C,0BAAqB,GAArB,qBAAqB,CAAuB;IAC5D,CAAC;IAIE,AAAN,KAAK,CAAC,aAAa,CAAsB,WAAmB;QAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IAChB,CAAC;IAIK,AAAN,KAAK,CAAC,+BAA+B,CACV,eAAuB;QAEhD,MAAM,MAAM,GACV,IAAI,CAAC,qBAAqB,CAAC,+BAA+B,CACxD,eAAe,CAChB,CAAC;QACJ,OAAO,MAAM,CAAC;IAChB,CAAC;IAIK,AAAN,KAAK,CAAC,iBAAiB,CAAwB,aAAqB;QAClE,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;QAC3E,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AA/BY,4DAAwB;AAQ7B;IAFL,IAAA,aAAI,EAAC,qBAAqB,CAAC;IAC3B,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACH,WAAA,IAAA,aAAI,EAAC,aAAa,CAAC,CAAA;;;;6DAGvC;AAIK;IAFL,IAAA,aAAI,EAAC,gBAAgB,CAAC;IACtB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IAErB,WAAA,IAAA,aAAI,EAAC,iBAAiB,CAAC,CAAA;;;;+EAOzB;AAIK;IAFL,IAAA,aAAI,EAAC,wBAAwB,CAAC;IAC9B,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACC,WAAA,IAAA,aAAI,EAAC,eAAe,CAAC,CAAA;;;;iEAG7C;mCA9BU,wBAAwB;IAFpC,IAAA,mBAAU,EAAC,iBAAiB,CAAC;IAC7B,IAAA,kBAAS,EAAC,wBAAY,CAAC;IAGnB,WAAA,IAAA,eAAM,EAAC,uBAAuB,CAAC,CAAA;qCACQ,+CAAqB;GAHpD,wBAAwB,CA+BpC"}
|
|
@@ -18,4 +18,13 @@ export declare class TaskController {
|
|
|
18
18
|
stage_id: number;
|
|
19
19
|
action_id: number;
|
|
20
20
|
}): Promise<any>;
|
|
21
|
+
getAllTask(req: Request & {
|
|
22
|
+
user: any;
|
|
23
|
+
}, body: {
|
|
24
|
+
mapped_entity_type: string;
|
|
25
|
+
mapped_entity_id: number;
|
|
26
|
+
status?: string;
|
|
27
|
+
mandatory?: boolean;
|
|
28
|
+
overdue?: boolean;
|
|
29
|
+
}): Promise<any[]>;
|
|
21
30
|
}
|
|
@@ -30,6 +30,11 @@ let TaskController = class TaskController {
|
|
|
30
30
|
const result = this.taskService.moveTask(loggedInUser, body);
|
|
31
31
|
return result;
|
|
32
32
|
}
|
|
33
|
+
async getAllTask(req, body) {
|
|
34
|
+
const loggedInUser = req.user.userData;
|
|
35
|
+
const result = this.taskService.getAllTask(loggedInUser, body);
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
33
38
|
};
|
|
34
39
|
exports.TaskController = TaskController;
|
|
35
40
|
__decorate([
|
|
@@ -49,6 +54,15 @@ __decorate([
|
|
|
49
54
|
__metadata("design:paramtypes", [Object, Object]),
|
|
50
55
|
__metadata("design:returntype", Promise)
|
|
51
56
|
], TaskController.prototype, "moveTask", null);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, common_1.Post)('/listing'),
|
|
59
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
60
|
+
__param(0, (0, common_1.Req)()),
|
|
61
|
+
__param(1, (0, common_1.Body)()),
|
|
62
|
+
__metadata("design:type", Function),
|
|
63
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
64
|
+
__metadata("design:returntype", Promise)
|
|
65
|
+
], TaskController.prototype, "getAllTask", null);
|
|
52
66
|
exports.TaskController = TaskController = __decorate([
|
|
53
67
|
(0, common_1.Controller)('/task'),
|
|
54
68
|
(0, common_1.UseGuards)(jwt_guard_1.JwtAuthGuard),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../../../src/module/workflow/controller/task.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,2DAAgE;AAChE,0DAAsD;AAI/C,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAIE,AAAN,KAAK,CAAC,sBAAsB,CACnB,GAA4B,EAEnC,IAKC;QAED,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAC1D,YAAY,EACZ,IAAI,CACL,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAGK,AAAN,KAAK,CAAC,QAAQ,CACL,GAA4B,EAEnC,IAKC;QAED,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC7D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;
|
|
1
|
+
{"version":3,"file":"task.controller.js","sourceRoot":"","sources":["../../../../src/module/workflow/controller/task.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CASwB;AACxB,2DAAgE;AAChE,0DAAsD;AAI/C,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAIE,AAAN,KAAK,CAAC,sBAAsB,CACnB,GAA4B,EAEnC,IAKC;QAED,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAC1D,YAAY,EACZ,IAAI,CACL,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAGK,AAAN,KAAK,CAAC,QAAQ,CACL,GAA4B,EAEnC,IAKC;QAED,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC7D,OAAO,MAAM,CAAC;IAChB,CAAC;IAIK,AAAN,KAAK,CAAC,UAAU,CACP,GAA4B,EAEnC,IAMC;QAED,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AA3DY,wCAAc;AAQnB;IAFL,IAAA,aAAI,EAAC,oBAAoB,CAAC;IAC1B,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IAErB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,aAAI,GAAE,CAAA;;;;4DAcR;AAGK;IADL,IAAA,aAAI,EAAC,YAAY,CAAC;IAEhB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,aAAI,GAAE,CAAA;;;;8CAWR;AAIK;IAFL,IAAA,aAAI,EAAC,UAAU,CAAC;IAChB,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IAErB,WAAA,IAAA,YAAG,GAAE,CAAA;IACL,WAAA,IAAA,aAAI,GAAE,CAAA;;;;gDAYR;yBA1DU,cAAc;IAF1B,IAAA,mBAAU,EAAC,OAAO,CAAC;IACnB,IAAA,kBAAS,EAAC,wBAAY,CAAC;IAGnB,WAAA,IAAA,eAAM,EAAC,aAAa,CAAC,CAAA;qCACQ,0BAAW;GAHhC,cAAc,CA2D1B"}
|
|
@@ -80,7 +80,7 @@ __decorate([
|
|
|
80
80
|
__metadata("design:type", String)
|
|
81
81
|
], TaskDataEntity.prototype, "task_owner", void 0);
|
|
82
82
|
__decorate([
|
|
83
|
-
(0, typeorm_1.Column)({ nullable: true
|
|
83
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
84
84
|
__metadata("design:type", Date)
|
|
85
85
|
], TaskDataEntity.prototype, "due_date", void 0);
|
|
86
86
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-data.entity.js","sourceRoot":"","sources":["../../../../src/module/workflow/entity/task-data.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAAuE;AACvE,qCAAyC;AAGlC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,+BAAU;IAC5C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,MA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AAE,CAAC;;0DACA;AAG3B;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACV;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+CACN;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;mDACtC;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACR;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACjB,IAAI;gDAAC;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;gDAC3B;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;4CAC/B;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;;4CAC/B;yBA7DF,cAAc;IAD1B,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;;GACvB,cAAc,CA8D1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { ActionCategory } from '../entity/action-category.entity';
|
|
3
|
+
export declare class ActionCategoryRepository {
|
|
4
|
+
private readonly actionCategoryRepository;
|
|
5
|
+
constructor(actionCategoryRepository: Repository<ActionCategory>);
|
|
6
|
+
getActionsCat(entity_type: string): Promise<{
|
|
7
|
+
label: any;
|
|
8
|
+
value: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
getReasonCodeByActionCategoryId(action_cat_code: string): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
value: null;
|
|
13
|
+
} | {
|
|
14
|
+
success: boolean;
|
|
15
|
+
value: string;
|
|
16
|
+
}>;
|
|
17
|
+
getActionCategory(action_cat_id: number): Promise<any[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.ActionCategoryRepository = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const typeorm_2 = require("typeorm");
|
|
19
|
+
const action_category_entity_1 = require("../entity/action-category.entity");
|
|
20
|
+
let ActionCategoryRepository = class ActionCategoryRepository {
|
|
21
|
+
constructor(actionCategoryRepository) {
|
|
22
|
+
this.actionCategoryRepository = actionCategoryRepository;
|
|
23
|
+
}
|
|
24
|
+
async getActionsCat(entity_type) {
|
|
25
|
+
const result = await this.actionCategoryRepository
|
|
26
|
+
.createQueryBuilder('ac')
|
|
27
|
+
.select(['ac.id', 'ac.name'])
|
|
28
|
+
.where('ac.mapped_entity_type = :entityType', { entityType: entity_type })
|
|
29
|
+
.getRawMany();
|
|
30
|
+
return result.map((row) => ({
|
|
31
|
+
label: row.ac_name,
|
|
32
|
+
value: String(row.ac_id),
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
async getReasonCodeByActionCategoryId(action_cat_code) {
|
|
36
|
+
const result = await this.actionCategoryRepository
|
|
37
|
+
.createQueryBuilder('ac')
|
|
38
|
+
.select(['ac.id', 'ac.reason_code'])
|
|
39
|
+
.where('ac.code = :code', { code: action_cat_code })
|
|
40
|
+
.getOne();
|
|
41
|
+
if (!result || !result.reason_code) {
|
|
42
|
+
return {
|
|
43
|
+
success: false,
|
|
44
|
+
value: null,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
success: true,
|
|
49
|
+
value: result.reason_code,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
async getActionCategory(action_cat_id) {
|
|
53
|
+
const result = await this.actionCategoryRepository
|
|
54
|
+
.createQueryBuilder('ac')
|
|
55
|
+
.select(['ac.*'])
|
|
56
|
+
.where('ac.id = :id', { id: action_cat_id })
|
|
57
|
+
.getRawMany();
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.ActionCategoryRepository = ActionCategoryRepository;
|
|
62
|
+
exports.ActionCategoryRepository = ActionCategoryRepository = __decorate([
|
|
63
|
+
(0, common_1.Injectable)(),
|
|
64
|
+
__param(0, (0, typeorm_1.InjectRepository)(action_category_entity_1.ActionCategory)),
|
|
65
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
66
|
+
], ActionCategoryRepository);
|
|
67
|
+
//# sourceMappingURL=action-category.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-category.repository.js","sourceRoot":"","sources":["../../../../src/module/workflow/repository/action-category.repository.ts"],"names":[],"mappings":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MAAM,GAAG,MAAM,IAAI,CAAC,wBAAwB;aAC/C,kBAAkB,CAAC,IAAI,CAAC;aACxB,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;aAChB,KAAK,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC;aAC3C,UAAU,EAAE,CAAC;QAEhB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAhDY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,uCAAc,CAAC,CAAA;qCACU,oBAAU;GAH5C,wBAAwB,CAgDpC"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { DataSource, Repository } from 'typeorm';
|
|
2
2
|
import { ActionEntity } from '../entity/action.entity';
|
|
3
|
+
import { UserData } from 'src/module/user/entity/user.entity';
|
|
3
4
|
export declare class ActionRepository {
|
|
4
5
|
private readonly actionRepository;
|
|
5
6
|
private readonly dataSource;
|
|
6
7
|
constructor(actionRepository: Repository<ActionEntity>, dataSource: DataSource);
|
|
8
|
+
getReasonCode(loggedInUser: UserData): Promise<any>;
|
|
9
|
+
defaultReasonCode(list_type: string, loggedInUser: UserData): Promise<any>;
|
|
10
|
+
getActions(loggedInUser: UserData, stage_id: number): Promise<any[]>;
|
|
7
11
|
getAction(organization_id: number, stage_id: number, mapped_entity_id: number, mapped_entity_type: string): Promise<{
|
|
8
12
|
value: any;
|
|
9
13
|
label: any;
|
|
@@ -22,6 +22,110 @@ let ActionRepository = class ActionRepository {
|
|
|
22
22
|
this.actionRepository = actionRepository;
|
|
23
23
|
this.dataSource = dataSource;
|
|
24
24
|
}
|
|
25
|
+
async getReasonCode(loggedInUser) {
|
|
26
|
+
const { organization_id } = loggedInUser;
|
|
27
|
+
const result = await this.dataSource.query(`
|
|
28
|
+
SELECT name, type
|
|
29
|
+
FROM cr_list_master
|
|
30
|
+
WHERE organization_id = ? AND source = 'master'
|
|
31
|
+
`, [organization_id]);
|
|
32
|
+
const formatted = result.map((item) => ({
|
|
33
|
+
label: item.name,
|
|
34
|
+
value: item.type,
|
|
35
|
+
}));
|
|
36
|
+
return formatted;
|
|
37
|
+
}
|
|
38
|
+
async defaultReasonCode(list_type, loggedInUser) {
|
|
39
|
+
const { organization_id } = loggedInUser;
|
|
40
|
+
if (!list_type) {
|
|
41
|
+
throw new common_1.BadRequestException('list_type is required');
|
|
42
|
+
}
|
|
43
|
+
const result = await this.dataSource.query(`
|
|
44
|
+
SELECT name, id
|
|
45
|
+
FROM cr_list_master_items
|
|
46
|
+
WHERE listtype = ? AND organization_id = ?
|
|
47
|
+
`, [list_type, organization_id]);
|
|
48
|
+
return result.map((row) => ({
|
|
49
|
+
label: row.name,
|
|
50
|
+
value: row.id,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
async getActions(loggedInUser, stage_id) {
|
|
54
|
+
const { organization_id } = loggedInUser;
|
|
55
|
+
const stageActions = await this.dataSource.query(`
|
|
56
|
+
SELECT id, action_id
|
|
57
|
+
FROM cr_wf_stage_action_mapping
|
|
58
|
+
WHERE stage_id = ?
|
|
59
|
+
`, [stage_id]);
|
|
60
|
+
if (!stageActions?.length)
|
|
61
|
+
return [];
|
|
62
|
+
const actionIds = stageActions.map((sa) => sa.action_id);
|
|
63
|
+
const mappingIds = stageActions.map((sa) => sa.id);
|
|
64
|
+
const templateMappings = await this.dataSource.query(`
|
|
65
|
+
SELECT stg_act_mapping_id, template_code
|
|
66
|
+
FROM cr_wf_action_template_mapping
|
|
67
|
+
WHERE stg_act_mapping_id IN (${mappingIds.map(() => '?').join(',')})
|
|
68
|
+
`, mappingIds);
|
|
69
|
+
const templateCodes = templateMappings.map((tm) => tm.template_code);
|
|
70
|
+
const templateCodeToName = {};
|
|
71
|
+
if (templateCodes.length > 0) {
|
|
72
|
+
const templates = await this.dataSource
|
|
73
|
+
.createQueryBuilder()
|
|
74
|
+
.select(['t.code AS code', 't.name AS name'])
|
|
75
|
+
.from('cr_wf_comm_template', 't')
|
|
76
|
+
.where('t.code IN (:...codes)', { codes: templateCodes })
|
|
77
|
+
.andWhere('t.organization_id = :orgId', { orgId: organization_id })
|
|
78
|
+
.getRawMany();
|
|
79
|
+
templates.forEach((tpl) => {
|
|
80
|
+
templateCodeToName[tpl.code] = tpl.name;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const mappingIdToTemplates = {};
|
|
84
|
+
for (const tm of templateMappings) {
|
|
85
|
+
const mappingId = tm.stg_act_mapping_id;
|
|
86
|
+
const name = templateCodeToName[tm.template_code];
|
|
87
|
+
if (name) {
|
|
88
|
+
if (!mappingIdToTemplates[mappingId]) {
|
|
89
|
+
mappingIdToTemplates[mappingId] = [];
|
|
90
|
+
}
|
|
91
|
+
mappingIdToTemplates[mappingId].push(name);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const actionIdToTemplates = {};
|
|
95
|
+
for (const sa of stageActions) {
|
|
96
|
+
const mappingId = sa.id;
|
|
97
|
+
const templates = mappingIdToTemplates[mappingId];
|
|
98
|
+
if (templates?.length) {
|
|
99
|
+
if (!actionIdToTemplates[sa.action_id]) {
|
|
100
|
+
actionIdToTemplates[sa.action_id] = [];
|
|
101
|
+
}
|
|
102
|
+
actionIdToTemplates[sa.action_id].push(...templates);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const actionResults = await this.dataSource
|
|
106
|
+
.createQueryBuilder()
|
|
107
|
+
.select([
|
|
108
|
+
'a.*',
|
|
109
|
+
'ac.name AS action_category',
|
|
110
|
+
'ar.name AS action_requirement',
|
|
111
|
+
])
|
|
112
|
+
.from('cr_wf_action', 'a')
|
|
113
|
+
.leftJoin('cr_wf_action_category', 'ac', 'ac.id = a.action_category')
|
|
114
|
+
.leftJoin('cr_list_master_items', 'ar', `ar.id = a.action_requirement AND ar.listtype = 'ACRQ' AND ar.organization_id = :orgId`, { orgId: organization_id })
|
|
115
|
+
.where('a.organization_id = :orgId', { orgId: organization_id })
|
|
116
|
+
.andWhere('a.id IN (:...actionIds)', { actionIds })
|
|
117
|
+
.getRawMany();
|
|
118
|
+
const enrichedResult = actionResults.map((row) => {
|
|
119
|
+
const actionId = Number(row.id);
|
|
120
|
+
const templates = actionIdToTemplates[actionId] || [];
|
|
121
|
+
const uniqueTemplates = [...new Set(templates)];
|
|
122
|
+
return {
|
|
123
|
+
...row,
|
|
124
|
+
template: uniqueTemplates.join(', '),
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
return enrichedResult;
|
|
128
|
+
}
|
|
25
129
|
async getAction(organization_id, stage_id, mapped_entity_id, mapped_entity_type) {
|
|
26
130
|
const stageActions = await this.dataSource.query(`SELECT id, action_id FROM cr_wf_stage_action_mapping WHERE stage_id = ?`, [stage_id]);
|
|
27
131
|
if (!stageActions?.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.repository.js","sourceRoot":"","sources":["../../../../src/module/workflow/repository/action.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKwB;AACxB,6CAAmD;AACnD,qCAAiD;AACjD,2DAAuD;
|
|
1
|
+
{"version":3,"file":"action.repository.js","sourceRoot":"","sources":["../../../../src/module/workflow/repository/action.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAKwB;AACxB,6CAAmD;AACnD,qCAAiD;AACjD,2DAAuD;AAIhD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAEmB,gBAA0C,EAC1C,UAAsB;QADtB,qBAAgB,GAAhB,gBAAgB,CAA0B;QAC1C,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAEJ,KAAK,CAAC,aAAa,CAAC,YAAsB;QACxC,MAAM,EAAE,eAAe,EAAE,GAAG,YAAY,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACxC;;;;QAIE,EACF,CAAC,eAAe,CAAC,CAClB,CAAC;QAEF,MA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gBACtB,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,IAAI,EAAE,GAAG,CAAC,oBAAoB;gBAC9B,WAAW;gBACX,mBAAmB,EAAE,GAAG,CAAC,mBAAmB;gBAC5C,UAAU,EAAE,GAAG,CAAC,aAAa,KAAK,CAAC;gBACnC,UAAU,EAAE,IAAI,EAAE,UAAU,IAAI,KAAK;gBACrC,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,KAAK;gBAC/B,YAAY,EAAE,IAAI,EAAE,YAAY,IAAI,KAAK;aAC1C,CAAC;QACJ,CAAC,CAAC,CAAC;QAGH,cAAc,CAAC,IAAI,CAAC;YAClB,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,SAAS;SACV,CAAC,CAAC;QAEV,OAAO,cAAc,CAAC;IACxB,CAAC;CACF,CAAA;AApQY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,4BAAY,CAAC,CAAA;qCACI,oBAAU;QAChB,oBAAU;GAJ9B,gBAAgB,CAoQ5B"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
2
|
-
import { UserData } from 'src/module/user/entity/user.entity';
|
|
3
2
|
import { DataSource } from 'typeorm';
|
|
3
|
+
import { ActionCategoryRepository } from '../repository/action-category.repository';
|
|
4
4
|
export declare class ActionCategoryService extends EntityServiceImpl {
|
|
5
5
|
private readonly dataSource;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
private readonly actionCategoryRepository;
|
|
7
|
+
constructor(dataSource: DataSource, actionCategoryRepository: ActionCategoryRepository);
|
|
8
|
+
getActionsCat(entity_type: string): Promise<{
|
|
9
|
+
label: any;
|
|
10
|
+
value: string;
|
|
11
|
+
}[]>;
|
|
8
12
|
getReasonCodeByActionCategoryId(action_cat_code: string): Promise<{
|
|
9
13
|
success: boolean;
|
|
10
|
-
value:
|
|
14
|
+
value: null;
|
|
15
|
+
} | {
|
|
16
|
+
success: boolean;
|
|
17
|
+
value: string;
|
|
11
18
|
}>;
|
|
12
|
-
getActionCategory(
|
|
19
|
+
getActionCategory(action_cat_id: number): Promise<any[]>;
|
|
13
20
|
}
|
|
@@ -13,47 +13,27 @@ exports.ActionCategoryService = void 0;
|
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const entity_service_impl_service_1 = require("../../meta/service/entity-service-impl.service");
|
|
15
15
|
const typeorm_1 = require("typeorm");
|
|
16
|
+
const action_category_repository_1 = require("../repository/action-category.repository");
|
|
16
17
|
let ActionCategoryService = class ActionCategoryService extends entity_service_impl_service_1.EntityServiceImpl {
|
|
17
|
-
constructor(dataSource) {
|
|
18
|
+
constructor(dataSource, actionCategoryRepository) {
|
|
18
19
|
super();
|
|
19
20
|
this.dataSource = dataSource;
|
|
21
|
+
this.actionCategoryRepository = actionCategoryRepository;
|
|
20
22
|
}
|
|
21
|
-
async getActionsCat(
|
|
22
|
-
|
|
23
|
-
console.log(entity_type, 'entity_type in action category service');
|
|
24
|
-
const result = await this.dataSource.query(`
|
|
25
|
-
SELECT id, name
|
|
26
|
-
FROM cr_wf_action_category
|
|
27
|
-
WHERE mapped_entity_type = ?`, [entity_type]);
|
|
28
|
-
return result.map((row) => ({
|
|
29
|
-
label: row.name,
|
|
30
|
-
value: row.id,
|
|
31
|
-
}));
|
|
23
|
+
async getActionsCat(entity_type) {
|
|
24
|
+
return this.actionCategoryRepository.getActionsCat(entity_type);
|
|
32
25
|
}
|
|
33
26
|
async getReasonCodeByActionCategoryId(action_cat_code) {
|
|
34
|
-
|
|
35
|
-
SELECT id, reason_code
|
|
36
|
-
FROM cr_wf_action_category
|
|
37
|
-
WHERE code = ?
|
|
38
|
-
`, [action_cat_code]);
|
|
39
|
-
return {
|
|
40
|
-
success: true,
|
|
41
|
-
value: result?.[0]?.reason_code || null,
|
|
42
|
-
};
|
|
27
|
+
return this.actionCategoryRepository.getReasonCodeByActionCategoryId(action_cat_code);
|
|
43
28
|
}
|
|
44
|
-
async getActionCategory(
|
|
45
|
-
|
|
46
|
-
const result = await this.dataSource.query(`
|
|
47
|
-
SELECT *
|
|
48
|
-
FROM cr_wf_action_category
|
|
49
|
-
WHERE id = ?
|
|
50
|
-
`, [action_cat_id]);
|
|
51
|
-
return result;
|
|
29
|
+
async getActionCategory(action_cat_id) {
|
|
30
|
+
return this.actionCategoryRepository.getActionCategory(action_cat_id);
|
|
52
31
|
}
|
|
53
32
|
};
|
|
54
33
|
exports.ActionCategoryService = ActionCategoryService;
|
|
55
34
|
exports.ActionCategoryService = ActionCategoryService = __decorate([
|
|
56
35
|
(0, common_1.Injectable)(),
|
|
57
|
-
__metadata("design:paramtypes", [typeorm_1.DataSource
|
|
36
|
+
__metadata("design:paramtypes", [typeorm_1.DataSource,
|
|
37
|
+
action_category_repository_1.ActionCategoryRepository])
|
|
58
38
|
], ActionCategoryService);
|
|
59
39
|
//# 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":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,gGAAwF;AAExF,qCAAqC;
|
|
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;AACrC,yFAAoF;AAG7E,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,+CAAiB;IAC1D,YACmB,UAAsB,EACtB,wBAAkD;QAEnE,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAY;QACtB,6BAAwB,GAAxB,wBAAwB,CAA0B;IAGrE,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,WAAmB;QACrC,OAAO,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,+BAA+B,CAAC,eAAuB;QAC3D,OAAO,IAAI,CAAC,wBAAwB,CAAC,+BAA+B,CAClE,eAAe,CAChB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,aAAqB;QAC3C,OAAO,IAAI,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;IACxE,CAAC;CACF,CAAA;AArBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAGoB,oBAAU;QACI,qDAAwB;GAH1D,qBAAqB,CAqBjC"}
|
|
@@ -127,108 +127,13 @@ let ActionService = class ActionService extends entity_service_impl_service_1.En
|
|
|
127
127
|
return deleteAction;
|
|
128
128
|
}
|
|
129
129
|
async getReasonCode(loggedInUser) {
|
|
130
|
-
|
|
131
|
-
const result = await this.dataSource.query(`
|
|
132
|
-
SELECT name, type
|
|
133
|
-
FROM cr_list_master
|
|
134
|
-
WHERE organization_id = ? AND source = 'master'
|
|
135
|
-
`, [organization_id]);
|
|
136
|
-
const formatted = result.map((item) => ({
|
|
137
|
-
label: item.name,
|
|
138
|
-
value: item.type,
|
|
139
|
-
}));
|
|
140
|
-
return formatted;
|
|
130
|
+
return this.actionRepository.getReasonCode(loggedInUser);
|
|
141
131
|
}
|
|
142
132
|
async defaultReasonCode(list_type, loggedInUser) {
|
|
143
|
-
|
|
144
|
-
if (!list_type) {
|
|
145
|
-
throw new common_1.BadRequestException('list_type is required');
|
|
146
|
-
}
|
|
147
|
-
const result = await this.dataSource.query(`
|
|
148
|
-
SELECT name, id
|
|
149
|
-
FROM cr_list_master_items
|
|
150
|
-
WHERE listtype = ? AND organization_id = ?
|
|
151
|
-
`, [list_type, organization_id]);
|
|
152
|
-
return result.map((row) => ({
|
|
153
|
-
label: row.name,
|
|
154
|
-
value: row.id,
|
|
155
|
-
}));
|
|
133
|
+
return this.actionRepository.defaultReasonCode(list_type, loggedInUser);
|
|
156
134
|
}
|
|
157
135
|
async getActions(loggedInUser, stage_id) {
|
|
158
|
-
|
|
159
|
-
const stageActions = await this.dataSource.query(`
|
|
160
|
-
SELECT id, action_id
|
|
161
|
-
FROM cr_wf_stage_action_mapping
|
|
162
|
-
WHERE stage_id = ?
|
|
163
|
-
`, [stage_id]);
|
|
164
|
-
if (!stageActions?.length)
|
|
165
|
-
return [];
|
|
166
|
-
const actionIds = stageActions.map((sa) => sa.action_id);
|
|
167
|
-
const mappingIds = stageActions.map((sa) => sa.id);
|
|
168
|
-
const templateMappings = await this.dataSource.query(`
|
|
169
|
-
SELECT stg_act_mapping_id, template_code
|
|
170
|
-
FROM cr_wf_action_template_mapping
|
|
171
|
-
WHERE stg_act_mapping_id IN (${mappingIds.map(() => '?').join(',')})
|
|
172
|
-
`, mappingIds);
|
|
173
|
-
const templateCodes = templateMappings.map((tm) => tm.template_code);
|
|
174
|
-
const templateCodeToName = {};
|
|
175
|
-
if (templateCodes.length > 0) {
|
|
176
|
-
const templates = await this.dataSource
|
|
177
|
-
.createQueryBuilder()
|
|
178
|
-
.select(['t.code AS code', 't.name AS name'])
|
|
179
|
-
.from('cr_wf_comm_template', 't')
|
|
180
|
-
.where('t.code IN (:...codes)', { codes: templateCodes })
|
|
181
|
-
.andWhere('t.organization_id = :orgId', { orgId: organization_id })
|
|
182
|
-
.getRawMany();
|
|
183
|
-
templates.forEach((tpl) => {
|
|
184
|
-
templateCodeToName[tpl.code] = tpl.name;
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
const mappingIdToTemplates = {};
|
|
188
|
-
for (const tm of templateMappings) {
|
|
189
|
-
const mappingId = tm.stg_act_mapping_id;
|
|
190
|
-
const name = templateCodeToName[tm.template_code];
|
|
191
|
-
if (name) {
|
|
192
|
-
if (!mappingIdToTemplates[mappingId]) {
|
|
193
|
-
mappingIdToTemplates[mappingId] = [];
|
|
194
|
-
}
|
|
195
|
-
mappingIdToTemplates[mappingId].push(name);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
const actionIdToTemplates = {};
|
|
199
|
-
for (const sa of stageActions) {
|
|
200
|
-
const mappingId = sa.id;
|
|
201
|
-
const templates = mappingIdToTemplates[mappingId];
|
|
202
|
-
if (templates?.length) {
|
|
203
|
-
if (!actionIdToTemplates[sa.action_id]) {
|
|
204
|
-
actionIdToTemplates[sa.action_id] = [];
|
|
205
|
-
}
|
|
206
|
-
actionIdToTemplates[sa.action_id].push(...templates);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
const actionResults = await this.dataSource
|
|
210
|
-
.createQueryBuilder()
|
|
211
|
-
.select([
|
|
212
|
-
'a.*',
|
|
213
|
-
'ac.name AS action_category',
|
|
214
|
-
'ar.name AS action_requirement',
|
|
215
|
-
])
|
|
216
|
-
.from('cr_wf_action', 'a')
|
|
217
|
-
.leftJoin('cr_wf_action_category', 'ac', 'ac.id = a.action_category')
|
|
218
|
-
.leftJoin('cr_list_master_items', 'ar', `ar.id = a.action_requirement AND ar.listtype = 'ACRQ' AND ar.organization_id = :orgId`, { orgId: organization_id })
|
|
219
|
-
.where('a.organization_id = :orgId', { orgId: organization_id })
|
|
220
|
-
.andWhere('a.id IN (:...actionIds)', { actionIds })
|
|
221
|
-
.getRawMany();
|
|
222
|
-
const enrichedResult = actionResults.map((row) => {
|
|
223
|
-
const actionId = Number(row.id);
|
|
224
|
-
const templates = actionIdToTemplates[actionId] || [];
|
|
225
|
-
const uniqueTemplates = [...new Set(templates)];
|
|
226
|
-
return {
|
|
227
|
-
...row,
|
|
228
|
-
template: uniqueTemplates.join(', '),
|
|
229
|
-
};
|
|
230
|
-
});
|
|
231
|
-
return enrichedResult;
|
|
136
|
+
return this.actionRepository.getActions(loggedInUser, stage_id);
|
|
232
137
|
}
|
|
233
138
|
async getAction(loggedInUser, stage_id, mapped_entity_id, mapped_entity_type) {
|
|
234
139
|
const { organization_id } = loggedInUser;
|