diff --git a/addons/api/addon/services/resource-filter-store.js b/addons/api/addon/services/resource-filter-store.js index 8bd4130ae..660fd8694 100644 --- a/addons/api/addon/services/resource-filter-store.js +++ b/addons/api/addon/services/resource-filter-store.js @@ -34,6 +34,7 @@ export class ResourceFilter { ); }) .flat(); + console.log(this.#filterObject, clauses); return this.and(clauses); } @@ -52,7 +53,7 @@ export class ResourceFilter { * @return {string} */ equals(key, value) { - return `"/item/${key}" == "${value}"`; + return value !== null ? `"/item/${key}" == "${value}"` : null; } /** @@ -76,7 +77,7 @@ export class ResourceFilter { * @return {string} */ parenthetical(expression) { - return `(${expression})`; + return expression ? `(${expression})` : null; } } diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index 89e2a82b5..0bfff1ff1 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -55,8 +55,9 @@ export default function () { this.get( '/auth-methods', - ({ authMethods }, { queryParams: { scope_id: scopeId } }) => { - return authMethods.where({ scopeId }); + ({ authMethods }, { queryParams: { scope_id: scopeId, filter } }) => { + const resultSet = authMethods.where({ scopeId }); + return resultSet.filter(makeBooleanFilter(filter)); } ); this.post('/auth-methods');