Consider root ast a collection

This commit is contained in:
rijkvanzanten
2020-10-08 14:15:51 -04:00
parent 2e6b295ee4
commit d8bd6c82ab

View File

@@ -78,12 +78,10 @@ export class AuthorizationService {
): { collection: string; field: string }[] {
const collections = [];
if (ast.type !== 'root') {
collections.push({
collection: ast.name,
field: ast.fieldKey || null,
});
}
collections.push({
collection: ast.name,
field: ast.type === 'root' ? null : ast.fieldKey,
});
for (const nestedNode of ast.children) {
if (nestedNode.type !== 'field') {