Merge branch 'main' into many-to-any

This commit is contained in:
rijkvanzanten
2020-10-09 15:58:43 -04:00
3 changed files with 8 additions and 1 deletions

View File

@@ -267,7 +267,7 @@ function removeTemporaryFields(
item[nestedCollection.fieldKey] = removeTemporaryFields(
rawItem[nestedCollection.fieldKey],
nestedCollection,
nestedCollection.parentKey
nestedCollection.relatedKey
);
}
}

View File

@@ -9,6 +9,7 @@ export type M2ONode = {
fieldKey: string;
relation: Relation;
parentKey: string;
relatedKey: string;
};
export type M2ANode = {
@@ -20,6 +21,9 @@ export type M2ANode = {
query: {
[collection: string]: Query;
};
relatedKey: {
[collection: string]: string;
};
fieldKey: string;
relation: Relation;
parentKey: string;
@@ -33,6 +37,7 @@ export type O2MNode = {
fieldKey: string;
relation: Relation;
parentKey: string;
relatedKey: string;
};
export type NestedCollectionNode = M2ONode | O2MNode | M2ANode;

View File

@@ -131,6 +131,7 @@ export default async function getASTFromQuery(
relation: relation,
query: {},
children: {},
relatedKey: {},
};
// for (const allowedCollection of allowedCollections) {
@@ -144,6 +145,7 @@ export default async function getASTFromQuery(
name: relatedCollection,
fieldKey: relationalField,
parentKey: await schemaInspector.primary(parentCollection),
relatedKey: await schemaInspector.primary(relatedCollection),
relation: relation,
query: deep?.[relationalField] || {},
children: await parseFields(relatedCollection, nestedFields),