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