rez_core 4.0.28 → 4.0.30

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": "4.0.28",
3
+ "version": "4.0.30",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -127,7 +127,6 @@ export class FieldMapperService extends EntityServiceImpl {
127
127
  entityType,
128
128
  parent_id,
129
129
  userData,
130
- mappedEntities?.[entityType],
131
130
  );
132
131
  } else {
133
132
  const relations = await this.datasource.query(
@@ -177,7 +176,9 @@ export class FieldMapperService extends EntityServiceImpl {
177
176
  inMemory[entityType][filterCode] =
178
177
  filterResponse?.data?.entity_list[0];
179
178
  } else {
180
- const firstId = targetEntityIds[0];
179
+ let firstId = targetEntityIds[0];
180
+ if (mappedEntities && mappedEntities[entityType])
181
+ firstId = mappedEntities[entityType];
181
182
  inMemory[entityType][filterCode] =
182
183
  await super.getResolvedEntityData(
183
184
  entityType,
@@ -504,12 +504,10 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
504
504
  entityType: string,
505
505
  entityId: number,
506
506
  loggedInUser: UserData,
507
- mapped_entity_id?: number,
508
507
  ): Promise<any> {
509
508
  const entityData = await this.entityMasterService.getEntityData(
510
509
  entityType,
511
510
  loggedInUser,
512
- mapped_entity_id,
513
511
  );
514
512
 
515
513
  if (!entityData.data_source) {
@@ -185,6 +185,7 @@ export class StageMovementRepository {
185
185
  `
186
186
  SELECT
187
187
  a.*,
188
+ m.id AS mapping_id,
188
189
  m.stage_id,
189
190
  ac.code AS action_category_code
190
191
  FROM frm_wf_action a
@@ -194,6 +195,24 @@ export class StageMovementRepository {
194
195
  `,
195
196
  [stageId],
196
197
  );
198
+
199
+ // Use for..of with await instead of map
200
+ for (const item of result) {
201
+ if (item.action_category_code === 'SDFM') {
202
+ const actionData = await this.dataSource.query(
203
+ `
204
+ SELECT arm.form_id
205
+ FROM frm_wf_action_resources_mapping arm
206
+ WHERE arm.stg_act_mapping_id = ? and form_id IS NOT NULL
207
+ LIMIT 1
208
+ `,
209
+ [item.mapping_id],
210
+ );
211
+
212
+ item.form_id = actionData[0]?.form_id || null;
213
+ }
214
+ }
215
+
197
216
  return result;
198
217
  }
199
218
 
@@ -1,4 +1,4 @@
1
- import { BadGatewayException, Inject, Injectable } from '@nestjs/common';
1
+ import { BadGatewayException, Inject, Injectable, Logger } from '@nestjs/common';
2
2
  import { ConfigService } from '@nestjs/config';
3
3
  import { InjectRepository } from '@nestjs/typeorm';
4
4
  import axios from 'axios';
@@ -30,6 +30,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
30
30
  @Inject('EntityModificationService')
31
31
  private readonly modificationService: EntityModificationService,
32
32
  private readonly configService: ConfigService,
33
+ private readonly logger = new Logger(WorkflowMetaService.name)
33
34
  ) {
34
35
  super();
35
36
  }
@@ -553,8 +554,9 @@ export class WorkflowMetaService extends EntityServiceImpl {
553
554
  console.error('Internal Entity API call failed:', error.message);
554
555
  }
555
556
 
556
- if (!owners?.length)
557
- throw new BadGatewayException('No eligible users found');
557
+ if (!owners?.length) this.logger.log(
558
+ `No eligible users found for lead assignment`,
559
+ );
558
560
  const userIds = owners?.map((o) => Number(o.id)); // normalize to numbers
559
561
 
560
562
  // 2) Find the last assigned *eligible* owner (use IN (...))