@koalarx/nest 3.1.37 → 3.1.38
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.
|
@@ -223,6 +223,17 @@ class RepositoryBase {
|
|
|
223
223
|
relations: this.listRelationEntities(entityInstance),
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
|
+
else if (entity[key]._action === entity_base_1.EntityActionType.create) {
|
|
227
|
+
relationCreates.push({
|
|
228
|
+
modelName: (0, KlString_1.toCamelCase)(modelName),
|
|
229
|
+
entityInstance,
|
|
230
|
+
schema: {
|
|
231
|
+
data: this.entityToPrisma(entityInstance),
|
|
232
|
+
select: this.getSelectRootPrismaSchema(entityInstance.constructor),
|
|
233
|
+
},
|
|
234
|
+
relations: this.listRelationEntities(entityInstance),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
226
237
|
}
|
|
227
238
|
});
|
|
228
239
|
return { relationCreates, relationUpdates, relationDeletes };
|
|
@@ -412,23 +423,7 @@ class RepositoryBase {
|
|
|
412
423
|
relation[relationPropName] =
|
|
413
424
|
this.getConnectPrismaSchemaForRelation(relationCreate.entityInstance, response);
|
|
414
425
|
}
|
|
415
|
-
return transaction
|
|
416
|
-
.create({
|
|
417
|
-
data: this.entityToPrisma(relation),
|
|
418
|
-
select: this.getSelectRootPrismaSchema(relation.constructor),
|
|
419
|
-
})
|
|
420
|
-
.then((response) => {
|
|
421
|
-
const idPropName = this.getIdPropName(relation);
|
|
422
|
-
if (!Array.isArray(idPropName)) {
|
|
423
|
-
relation[idPropName] = response[idPropName];
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
idPropName.forEach((propName) => {
|
|
427
|
-
relation[propName] = response[propName];
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
return this.persistRelations(transaction, relation);
|
|
431
|
-
});
|
|
426
|
+
return this.persistRelations(transaction, relation);
|
|
432
427
|
}));
|
|
433
428
|
})),
|
|
434
429
|
]);
|