pangea-server 1.0.28 → 1.0.29
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()) {
|
|
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 = `${model.name}.${relName}`;
|
|
211
211
|
const currentDepth = relDepth.get(relKey) || 0;
|
|
212
212
|
const maxDepth = rel.joinDepth;
|
|
213
213
|
if (currentDepth >= maxDepth)
|
|
@@ -220,14 +220,12 @@ function getIncludeAndWhere(model, includeItems, where, relDepth = new Map(), pa
|
|
|
220
220
|
const newRelDepth = new Map(relDepth);
|
|
221
221
|
newRelDepth.set(relKey, currentDepth + 1);
|
|
222
222
|
const relModel = rel.getModelFn();
|
|
223
|
-
const nested = getIncludeAndWhere(relModel, nestedIncludeItems, relWhere, newRelDepth, relKey);
|
|
224
223
|
includeOptions.push({
|
|
225
224
|
model: relModel,
|
|
226
225
|
as: relName,
|
|
227
226
|
required: rel.required,
|
|
228
227
|
paranoid: rel.paranoid,
|
|
229
|
-
|
|
230
|
-
...(nested.where && { where: nested.where }),
|
|
228
|
+
...getIncludeAndWhere(relModel, nestedIncludeItems, relWhere, newRelDepth),
|
|
231
229
|
});
|
|
232
230
|
}
|
|
233
231
|
return {
|