apply filtering to auth-methods mocks and fix null handling

This commit is contained in:
Randall Morey committed 2021-11-10 11:25:02 -05:00
1 parent 80a82ea925
commit 1935771a70
2 files changed
+6 -4

No files matched your search

@@ -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;
}
}
+3 -2
View File
@@ -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');