@koalarx/nest 3.1.23 → 3.1.24
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.
|
@@ -350,7 +350,9 @@ class RepositoryBase {
|
|
|
350
350
|
}
|
|
351
351
|
persistRelations(transaction, entity) {
|
|
352
352
|
const { relationCreates, relationUpdates, relationDeletes } = this.listToRelationActionList(entity);
|
|
353
|
-
return Promise.all([
|
|
353
|
+
return Promise.all(relationDeletes.map((relation) => transaction[relation.modelName].deleteMany({
|
|
354
|
+
where: relation.schema,
|
|
355
|
+
}))).then(() => Promise.all([
|
|
354
356
|
...relationCreates.map((relationCreate) => transaction[relationCreate.modelName]
|
|
355
357
|
.create(relationCreate.schema)
|
|
356
358
|
.then((response) => {
|
|
@@ -382,10 +384,8 @@ class RepositoryBase {
|
|
|
382
384
|
return this.persistRelations(transaction, relation);
|
|
383
385
|
});
|
|
384
386
|
}));
|
|
385
|
-
}), ...relationUpdates.map((relation) => transaction[relation.modelName].update(relation.schema)),
|
|
386
|
-
|
|
387
|
-
}))),
|
|
388
|
-
]);
|
|
387
|
+
}), ...relationUpdates.map((relation) => transaction[relation.modelName].update(relation.schema))),
|
|
388
|
+
]));
|
|
389
389
|
}
|
|
390
390
|
context(transactionalClient) {
|
|
391
391
|
const modelName = this._modelName.name;
|