rez_core 2.1.152 → 2.1.154
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/entity/action-data.entity.d.ts +3 -0
- package/dist/module/workflow/entity/action-data.entity.js +12 -0
- package/dist/module/workflow/entity/action-data.entity.js.map +1 -1
- package/dist/module/workflow/entity/action.entity.d.ts +2 -2
- package/dist/module/workflow/entity/action.entity.js +4 -4
- package/dist/module/workflow/entity/action.entity.js.map +1 -1
- package/dist/module/workflow/entity/task-data.entity.d.ts +12 -4
- package/dist/module/workflow/entity/task-data.entity.js +37 -5
- package/dist/module/workflow/entity/task-data.entity.js.map +1 -1
- package/dist/module/workflow/repository/task.repository.d.ts +1 -1
- package/dist/module/workflow/repository/task.repository.js.map +1 -1
- package/dist/module/workflow/service/workflow.service.js +19 -6
- package/dist/module/workflow/service/workflow.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/workflow/entity/action-data.entity.ts +9 -0
- package/src/module/workflow/entity/action.entity.ts +4 -4
- package/src/module/workflow/entity/task-data.entity.ts +29 -5
- package/src/module/workflow/repository/task.repository.ts +4 -4
- package/src/module/workflow/service/workflow.service.ts +33 -7
package/package.json
CHANGED
|
@@ -31,4 +31,13 @@ export class ActionDataEntity extends BaseEntity {
|
|
|
31
31
|
|
|
32
32
|
@Column({ nullable: true })
|
|
33
33
|
mapped_entity_type: string;
|
|
34
|
+
|
|
35
|
+
@Column({ nullable: true })
|
|
36
|
+
sequence: number;
|
|
37
|
+
|
|
38
|
+
@Column({ default: 0 })
|
|
39
|
+
is_done: boolean;
|
|
40
|
+
|
|
41
|
+
@Column({ type: 'varchar', nullable: true })
|
|
42
|
+
is_current: string;
|
|
34
43
|
}
|
|
@@ -12,8 +12,8 @@ export class ActionEntity extends BaseEntity {
|
|
|
12
12
|
@Column({ type: 'int', nullable: true })
|
|
13
13
|
workflow_id: number;
|
|
14
14
|
|
|
15
|
-
@Column({ type: '
|
|
16
|
-
action_category:
|
|
15
|
+
@Column({ type: 'varchar', nullable: true })
|
|
16
|
+
action_category: string;
|
|
17
17
|
|
|
18
18
|
@Column({ type: 'varchar', nullable: true })
|
|
19
19
|
action_requirement: string;
|
|
@@ -24,8 +24,8 @@ export class ActionEntity extends BaseEntity {
|
|
|
24
24
|
@Column({ type: 'varchar', nullable: true })
|
|
25
25
|
reason_code: string;
|
|
26
26
|
|
|
27
|
-
@Column({ type: '
|
|
28
|
-
default_reason_code:
|
|
27
|
+
@Column({ type: 'varchar', nullable: true })
|
|
28
|
+
default_reason_code: string;
|
|
29
29
|
|
|
30
30
|
@Column({ default: 0, type: 'boolean' })
|
|
31
31
|
default_value: boolean;
|
|
@@ -5,20 +5,20 @@ import { Column, Entity } from 'typeorm';
|
|
|
5
5
|
export class TaskDataEntity extends BaseEntity {
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
|
-
this.entity_type = '
|
|
8
|
+
this.entity_type = 'TASK';
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
@Column({ nullable: true })
|
|
12
|
-
task_id:
|
|
12
|
+
task_id: string;
|
|
13
13
|
|
|
14
14
|
@Column({ nullable: true })
|
|
15
|
-
user_id:
|
|
15
|
+
user_id: string;
|
|
16
16
|
|
|
17
17
|
@Column({ nullable: true })
|
|
18
|
-
stage_id:
|
|
18
|
+
stage_id: string;
|
|
19
19
|
|
|
20
20
|
@Column({ nullable: true })
|
|
21
|
-
action_id:
|
|
21
|
+
action_id: string;
|
|
22
22
|
|
|
23
23
|
@Column({ nullable: true })
|
|
24
24
|
start_time: Date;
|
|
@@ -40,4 +40,28 @@ export class TaskDataEntity extends BaseEntity {
|
|
|
40
40
|
|
|
41
41
|
@Column({ nullable: true })
|
|
42
42
|
mapped_entity_type: string;
|
|
43
|
+
|
|
44
|
+
@Column({ nullable: true })
|
|
45
|
+
sequence: number;
|
|
46
|
+
|
|
47
|
+
@Column({ default: 0 })
|
|
48
|
+
is_done: boolean;
|
|
49
|
+
|
|
50
|
+
@Column({ nullable: true })
|
|
51
|
+
task_status: string;
|
|
52
|
+
|
|
53
|
+
@Column({ nullable: true })
|
|
54
|
+
task_name: string;
|
|
55
|
+
|
|
56
|
+
@Column({ nullable: true, type: 'varchar', length: 1000 })
|
|
57
|
+
description: string;
|
|
58
|
+
|
|
59
|
+
@Column({ nullable: true })
|
|
60
|
+
task_owner: string;
|
|
61
|
+
|
|
62
|
+
@Column({ nullable: true, type: 'varchar' })
|
|
63
|
+
due_date: Date;
|
|
64
|
+
|
|
65
|
+
@Column({ nullable: true, type: 'varchar' })
|
|
66
|
+
due_time: string;
|
|
43
67
|
}
|
|
@@ -11,10 +11,10 @@ export class TaskRepository {
|
|
|
11
11
|
) {}
|
|
12
12
|
|
|
13
13
|
async getAllTaskByUserIdAndStageId(
|
|
14
|
-
userId
|
|
15
|
-
stageId
|
|
16
|
-
mapped_entity_type
|
|
17
|
-
mapped_entity_id
|
|
14
|
+
userId,
|
|
15
|
+
stageId,
|
|
16
|
+
mapped_entity_type,
|
|
17
|
+
mapped_entity_id,
|
|
18
18
|
) {
|
|
19
19
|
const result = await this.TaskRepository.find({
|
|
20
20
|
where: {
|
|
@@ -57,6 +57,7 @@ export class WorkflowService extends EntityServiceImpl {
|
|
|
57
57
|
);
|
|
58
58
|
|
|
59
59
|
const workflowId = entityData.id;
|
|
60
|
+
const { level_id, level_type, organization_id } = loggedInUser;
|
|
60
61
|
|
|
61
62
|
// Handle INACTIVE status validation
|
|
62
63
|
if (entityData.status == resolveStatus.id) {
|
|
@@ -85,15 +86,40 @@ export class WorkflowService extends EntityServiceImpl {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
// Handle is_default uniqueness logic
|
|
89
|
+
// Handle is_default uniqueness logic within same level
|
|
89
90
|
if ((entityData as Workflow).is_default == true) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
// Step 1: Get previous default workflow for same level_id and level_type
|
|
92
|
+
const oldDefault = await this.dataSource.query(
|
|
93
|
+
`
|
|
94
|
+
SELECT id FROM cr_workflow
|
|
95
|
+
WHERE level_id = ? AND level_type = ?
|
|
96
|
+
`,
|
|
97
|
+
[level_id, level_type],
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (oldDefault?.length) {
|
|
101
|
+
const oldWorkflowId = oldDefault[0].id;
|
|
102
|
+
|
|
103
|
+
// Step 2: Update old workflow to is_default = 0
|
|
104
|
+
await this.dataSource
|
|
105
|
+
.createQueryBuilder()
|
|
106
|
+
.update(Workflow)
|
|
107
|
+
.set({ is_default: 0 })
|
|
108
|
+
.where('id = :id', { id: oldWorkflowId })
|
|
109
|
+
.execute();
|
|
110
|
+
|
|
111
|
+
// Step 3: Update cr_workflow_level_mapping to point to new workflowId
|
|
112
|
+
await this.dataSource.query(
|
|
113
|
+
`
|
|
114
|
+
UPDATE cr_workflow_level_mapping
|
|
115
|
+
SET workflow_id = ?
|
|
116
|
+
WHERE mapped_level_id = ? AND mapped_level_type = ?
|
|
117
|
+
`,
|
|
118
|
+
[workflowId, level_id, level_type],
|
|
119
|
+
);
|
|
120
|
+
}
|
|
96
121
|
}
|
|
122
|
+
|
|
97
123
|
// Final update
|
|
98
124
|
return super.updateEntity(entityData, loggedInUser);
|
|
99
125
|
}
|