@koalarx/nest 3.1.43 → 3.1.44

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.
@@ -505,18 +505,10 @@ class RepositoryBase {
505
505
  entityInstance._hasUpdate = false;
506
506
  }
507
507
  autofillCreatedId(entity, response) {
508
- const entityProps = auto_mapping_list_1.AutoMappingList.getAllProps(entity.constructor);
509
508
  this.setIdOnEntity(entity, response);
510
- entityProps.forEach((prop) => {
511
- let instance;
512
- try {
513
- instance = new (prop.type())();
514
- }
515
- catch {
516
- instance = null;
517
- }
518
- if (instance instanceof entity_base_1.EntityBase) {
519
- this.setIdOnEntity(entity[prop.name], response[prop.name]);
509
+ Object.keys(entity).forEach((key) => {
510
+ if (entity[key] instanceof entity_base_1.EntityBase && response[key]) {
511
+ this.setIdOnEntity(entity[key], response[key]);
520
512
  }
521
513
  });
522
514
  }
@@ -600,8 +592,12 @@ class RepositoryBase {
600
592
  .update({
601
593
  where,
602
594
  data: prismaEntity,
595
+ select: this.getSelectRootPrismaSchema(entity.constructor),
603
596
  })
604
- .then(() => this.persistRelations(client, entity))).then(() => this.findUnique(where));
597
+ .then((response) => {
598
+ this.autofillCreatedId(entity, response);
599
+ return this.persistRelations(client, entity);
600
+ })).then(() => this.findUnique(where));
605
601
  }
606
602
  }
607
603
  async saveMany(entities, updateWhere) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest",
3
- "version": "3.1.43",
3
+ "version": "3.1.44",
4
4
  "description": "",
5
5
  "author": "Igor D. Rangel",
6
6
  "license": "MIT",