rez_core 2.2.21 → 2.2.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.2.21",
3
+ "version": "2.2.22",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -25,6 +25,10 @@ export class ActionDataRepository {
25
25
 
26
26
  if (action.length > 0) {
27
27
  for (const act of action) {
28
+ const is_mandatory = await this.dataSource.query(
29
+ `SELECT code FROM cr_list_master_items WHERE id = ? and organization_id = ? LIMIT 1;`,
30
+ [act.action_requirement, loggedInUser.organization_id],
31
+ );
28
32
  const isFirst = act.sequence == minSequence;
29
33
  const actionData = this.actionDataRepo.create({
30
34
  stage_id: act.stage_id,
@@ -35,6 +39,7 @@ export class ActionDataRepository {
35
39
  mapped_entity_type,
36
40
  is_current: isFirst ? 'Y' : null,
37
41
  start_time: isFirst ? new Date() : null,
42
+ is_mandatory: is_mandatory[0]?.code === 'mandatory' ? true : false,
38
43
  } as ActionDataEntity);
39
44
  await this.actionDataRepo.save(actionData);
40
45
  }
@@ -29,7 +29,14 @@ export class ActionRepository {
29
29
  [stage_id],
30
30
  );
31
31
 
32
- if (!stageActions?.length) return [];
32
+ if (!stageActions?.length) {
33
+ return [
34
+ {
35
+ value: 0,
36
+ label: 'Generic',
37
+ },
38
+ ];
39
+ }
33
40
 
34
41
  const actionIds = stageActions.map((sa) => sa.action_id);
35
42
 
@@ -38,14 +38,23 @@ export class TaskRepository {
38
38
 
39
39
  if (action.length > 0) {
40
40
  for (const act of action) {
41
+ // search that is_mandatory is true or not in list_master_items for the given organization
42
+
43
+ const is_mandatory = await this.dataSource.query(
44
+ `SELECT code FROM cr_list_master_items WHERE id = ? and organization_id = ? LIMIT 1;`,
45
+ [act.action_requirement, loggedInUser.organization_id],
46
+ );
47
+
41
48
  const taskData = this.TaskRepository.create({
42
49
  stage_id: act.stage_id,
43
50
  user_id: loggedInUser.id,
44
51
  action_id: act.id,
45
52
  name: act.name,
46
53
  sequence: act.sequence,
54
+ is_mandatory: is_mandatory[0]?.code === 'mandatory' ? true : false,
47
55
  mapped_entity_id,
48
56
  mapped_entity_type,
57
+
49
58
  is_system: true,
50
59
  status: todoListMasterItemId[0]?.id,
51
60
  } as TaskDataEntity);
@@ -151,13 +151,11 @@ export class WorkflowMetaService extends EntityServiceImpl {
151
151
  return `Initialized workflow with first stage (Stage ID: ${firstStage.id}).`;
152
152
  }
153
153
 
154
- //idhr
155
-
156
154
  // Case 2: Has next stage – move forward
157
- const stageDate = await this.getNextStage(currentStage);
155
+ const stageData = await this.getNextStage(currentStage);
158
156
 
159
- if (stageDate.hasNextStage) {
160
- const { nextStage } = stageDate;
157
+ if (stageData.hasNextStage) {
158
+ const { nextStage } = stageData;
161
159
  // Close current stage
162
160
  currentStage.end_date = now;
163
161
  currentStage.is_current = 'N';
@@ -179,7 +177,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
179
177
  });
180
178
 
181
179
  this.populateActionService(
182
- currentStage.stage_id,
180
+ stageData.nextStage.id,
183
181
  loggedInUser,
184
182
  mapped_entity_id,
185
183
  mapped_entity_type,