pangea-server 1.0.22 → 1.0.23
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.
|
@@ -203,11 +203,11 @@ function convertWhereKeys(obj) {
|
|
|
203
203
|
}
|
|
204
204
|
return obj;
|
|
205
205
|
}
|
|
206
|
-
function getIncludeAndWhere(model, includeItems, where, relDepth = new Map()) {
|
|
206
|
+
function getIncludeAndWhere(model, includeItems, where, relDepth = new Map(), parentKey = model.name) {
|
|
207
207
|
const includeOptions = [];
|
|
208
208
|
const cleanWhere = { ...where };
|
|
209
209
|
for (const [relName, rel] of Object.entries(model.Relations)) {
|
|
210
|
-
const relKey = `${
|
|
210
|
+
const relKey = `${parentKey}->${relName}`;
|
|
211
211
|
const currentDepth = relDepth.get(relKey) || 0;
|
|
212
212
|
const maxDepth = rel.joinDepth;
|
|
213
213
|
if (currentDepth >= maxDepth)
|
|
@@ -225,7 +225,7 @@ function getIncludeAndWhere(model, includeItems, where, relDepth = new Map()) {
|
|
|
225
225
|
as: relName,
|
|
226
226
|
required: rel.required,
|
|
227
227
|
paranoid: rel.paranoid,
|
|
228
|
-
...getIncludeAndWhere(relModel, nestedIncludeItems, relWhere, newRelDepth),
|
|
228
|
+
...getIncludeAndWhere(relModel, nestedIncludeItems, relWhere, newRelDepth, relKey),
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
return {
|