@koalarx/nest 3.1.24 → 3.1.25

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.
@@ -348,11 +348,12 @@ class RepositoryBase {
348
348
  }
349
349
  return data;
350
350
  }
351
- persistRelations(transaction, entity) {
351
+ async persistRelations(transaction, entity) {
352
352
  const { relationCreates, relationUpdates, relationDeletes } = this.listToRelationActionList(entity);
353
- return Promise.all(relationDeletes.map((relation) => transaction[relation.modelName].deleteMany({
353
+ await Promise.all(relationDeletes.map((relation) => transaction[relation.modelName].deleteMany({
354
354
  where: relation.schema,
355
- }))).then(() => Promise.all([
355
+ })));
356
+ return Promise.all([
356
357
  ...relationCreates.map((relationCreate) => transaction[relationCreate.modelName]
357
358
  .create(relationCreate.schema)
358
359
  .then((response) => {
@@ -385,7 +386,7 @@ class RepositoryBase {
385
386
  });
386
387
  }));
387
388
  }), ...relationUpdates.map((relation) => transaction[relation.modelName].update(relation.schema))),
388
- ]));
389
+ ]);
389
390
  }
390
391
  context(transactionalClient) {
391
392
  const modelName = this._modelName.name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest",
3
- "version": "3.1.24",
3
+ "version": "3.1.25",
4
4
  "description": "",
5
5
  "author": "Igor D. Rangel",
6
6
  "license": "MIT",