rez_core 1.0.99 → 1.1.0

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": "1.0.99",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -257,17 +257,27 @@ export class MasterService {
257
257
  continue;
258
258
  }
259
259
 
260
+ const existingError = errors.find((e) => e.row === i + 1);
261
+
260
262
  if (refData[0].organization_id !== loggedInUser.organization_id) {
261
- errors.push({
262
- row: i + 1,
263
- errors: [
264
- {
265
- field: attr.name,
266
- message: `Reference entity with code ${row[attr.attribute_key]} does not belong to the organization`,
267
- },
268
- ],
269
- });
270
- continue;
263
+ if (existingError) {
264
+ existingError.errors.push({
265
+ field: attr.name,
266
+ message: `Reference entity not found for code: ${row[attr.attribute_key]} does not belong to the organization`,
267
+ });
268
+ continue;
269
+ } else {
270
+ errors.push({
271
+ row: i + 1,
272
+ errors: [
273
+ {
274
+ field: attr.name,
275
+ message: `Reference entity with code ${row[attr.attribute_key]} does not belong to the organization`,
276
+ },
277
+ ],
278
+ });
279
+ continue;
280
+ }
271
281
  }
272
282
 
273
283
  row[attr.attribute_key] = refData[0].id;
@@ -407,11 +417,17 @@ export class MasterService {
407
417
  entityMaster,
408
418
  );
409
419
 
420
+ const existingError = errors.find((e) => e.row === i + 1);
421
+
410
422
  if (rowErrors?.length > 0) {
411
- errors.push({
412
- row: i + 1,
413
- errors: rowErrors,
414
- });
423
+ if (existingError) {
424
+ existingError.errors.push(...rowErrors);
425
+ } else {
426
+ errors.push({
427
+ row: i + 1,
428
+ errors: rowErrors,
429
+ });
430
+ }
415
431
  }
416
432
  }
417
433
 
@@ -419,7 +435,7 @@ export class MasterService {
419
435
  throw new BadRequestException({
420
436
  status: false,
421
437
  message: `Validation errors found in the uploaded data.`,
422
- details: errors,
438
+ error: errors,
423
439
  });
424
440
  }
425
441