pangea-server 1.0.20 → 1.0.22
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,15 +203,12 @@ 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
|
-
console.log(`----- Model: ${model.name} -----`);
|
|
210
209
|
for (const [relName, rel] of Object.entries(model.Relations)) {
|
|
211
|
-
const relKey = `${
|
|
212
|
-
console.log(`----- relKey: ${relKey} -----`);
|
|
210
|
+
const relKey = `${model.name}.${relName}`;
|
|
213
211
|
const currentDepth = relDepth.get(relKey) || 0;
|
|
214
|
-
console.log(`----- currentDepth: ${currentDepth} -----`);
|
|
215
212
|
const maxDepth = rel.joinDepth;
|
|
216
213
|
if (currentDepth >= maxDepth)
|
|
217
214
|
continue;
|
|
@@ -223,14 +220,12 @@ function getIncludeAndWhere(model, includeItems, where, relDepth = new Map(), pa
|
|
|
223
220
|
const newRelDepth = new Map(relDepth);
|
|
224
221
|
newRelDepth.set(relKey, currentDepth + 1);
|
|
225
222
|
const relModel = rel.getModelFn();
|
|
226
|
-
console.log(`----- relModel: ${relModel.name} -----`);
|
|
227
223
|
includeOptions.push({
|
|
228
224
|
model: relModel,
|
|
229
225
|
as: relName,
|
|
230
226
|
required: rel.required,
|
|
231
227
|
paranoid: rel.paranoid,
|
|
232
|
-
|
|
233
|
-
...getIncludeAndWhere(relModel, nestedIncludeItems, relWhere, newRelDepth, relKey),
|
|
228
|
+
...getIncludeAndWhere(relModel, nestedIncludeItems, relWhere, newRelDepth),
|
|
234
229
|
});
|
|
235
230
|
}
|
|
236
231
|
return {
|