@koalarx/nest 3.1.15 → 3.1.16
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.
|
@@ -58,17 +58,22 @@ class RepositoryBase {
|
|
|
58
58
|
}
|
|
59
59
|
getSelectRootPrismaSchema(entity) {
|
|
60
60
|
const selectSchema = {};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
const entityProps = auto_mapping_list_1.AutoMappingList.getAllProps(entity);
|
|
62
|
+
entityProps.forEach((prop) => {
|
|
63
|
+
let instance;
|
|
64
|
+
try {
|
|
65
|
+
instance = new (prop.type())();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
instance = null;
|
|
69
|
+
}
|
|
70
|
+
if (instance instanceof entity_base_1.EntityBase) {
|
|
71
|
+
selectSchema[prop.name] = {
|
|
72
|
+
select: this.getSelectRootPrismaSchema(instance.constructor),
|
|
68
73
|
};
|
|
69
74
|
}
|
|
70
75
|
else {
|
|
71
|
-
selectSchema[
|
|
76
|
+
selectSchema[prop.name] = true;
|
|
72
77
|
}
|
|
73
78
|
});
|
|
74
79
|
return selectSchema;
|
|
@@ -285,7 +290,7 @@ class RepositoryBase {
|
|
|
285
290
|
async loadRelationForEntity(where, entity, cache) {
|
|
286
291
|
return this._context[(0, KlString_1.toCamelCase)((0, KlString_1.toCamelCase)(entity.name))]
|
|
287
292
|
.findFirst({
|
|
288
|
-
select: this.
|
|
293
|
+
select: this.getSelectRootPrismaSchema(entity),
|
|
289
294
|
where,
|
|
290
295
|
})
|
|
291
296
|
.then((data) => this.enrichEntityWithRelations(entity, data, cache));
|