Fix deep querying in nested o2m in m2a structure

This commit is contained in:
rijkvanzanten
2021-04-22 10:10:41 -04:00
parent ce6e36cdc9
commit f873f184f5
2 changed files with 5 additions and 12 deletions

View File

@@ -162,10 +162,12 @@ export default async function getASTFromQuery(
for (const relatedCollection of allowedCollections) {
child.children[relatedCollection] = await parseFields(
relatedCollection,
Array.isArray(nestedFields) ? nestedFields : (nestedFields as anyNested)[relatedCollection] || ['*']
Array.isArray(nestedFields) ? nestedFields : (nestedFields as anyNested)[relatedCollection] || ['*'],
deep?.[`${relationalField}:${relatedCollection}`]
);
child.query[relatedCollection] = {};
child.query[relatedCollection] = getDeepQuery(deep?.[`${relationalField}:${relatedCollection}`] || {});
child.relatedKey[relatedCollection] = schema.collections[relatedCollection].primary;
}
} else if (relatedCollection) {