Fix deep filters in app, fix current-user/current-role in filters

This commit is contained in:
rijkvanzanten
2020-11-12 14:12:05 -05:00
parent 236bde3c59
commit 0c72ee6b1d
3 changed files with 18 additions and 5 deletions

View File

@@ -13,7 +13,18 @@ export default function filtersToQuery(filters: readonly Filter[]) {
if (!value) continue;
filterList.push({ [field]: { [`_${operator}`]: value } });
if (field.includes('.')) {
let filter: Record<string, any> = { [`_${operator}`]: value };
const path = field.split('.');
for (const field of path.reverse()) {
filter = { [field]: filter };
}
filterList.push(filter);
} else {
filterList.push({ [field]: { [`_${operator}`]: value } });
}
}
let filterQuery: Record<string, any> = {};