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