rez_core 3.1.122 → 3.1.123

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": "3.1.122",
3
+ "version": "3.1.123",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -59,6 +59,11 @@ export class PopulateMetaService {
59
59
  ];
60
60
  const entityTypeToNewIdMap = new Map<string, number>();
61
61
 
62
+ const getStatus = await this.dataSource.query(
63
+ `SELECT * FROM cr_list_master_items WHERE organization_id = ${organization_id} AND code = "STATUS_ACTIVE"`,
64
+ );
65
+ const status = getStatus[0]?.id ? getStatus[0].id : 'ACTIVE';
66
+
62
67
  // Step 1: Insert basic metadata tables
63
68
  for (const table of metadataTables) {
64
69
  const factoryData = await this.dataSource.query(
@@ -78,6 +83,7 @@ export class PopulateMetaService {
78
83
  level_id: organization_id,
79
84
  is_unique: rest.is_unique == 1 ? true : false,
80
85
  required: rest.required == 1 ? true : false,
86
+ status: status,
81
87
  }),
82
88
  );
83
89
  } else {
@@ -87,6 +93,7 @@ export class PopulateMetaService {
87
93
  organization_id,
88
94
  level_type: 'ORG',
89
95
  level_id: organization_id,
96
+ status: status,
90
97
  }),
91
98
  );
92
99
  }
@@ -64,8 +64,25 @@ export class WorkflowMetaService extends EntityServiceImpl {
64
64
  });
65
65
 
66
66
  if (!currentStage) {
67
- // If no current stage found, return null
68
- return null;
67
+ // Fetch the latest stage movement for the given entity
68
+ const latestMovement = await this.stageMovementRepo.findOne({
69
+ where: {
70
+ mapped_entity_type,
71
+ mapped_entity_id,
72
+ },
73
+ order: { id: 'DESC' }, // Get the most recent movement
74
+ });
75
+
76
+ if (!latestMovement) return null;
77
+
78
+ const getGroupName = await this.dataSource.query(
79
+ `SELECT name FROM cr_wf_stage_group WHERE id = ${latestMovement?.stage_group_id}`,
80
+ );
81
+
82
+ return {
83
+ ...latestMovement,
84
+ stage_group_name: getGroupName[0]?.name,
85
+ };
69
86
  }
70
87
 
71
88
  // get group name for the current stage