apply filtering to auth-methods mocks and fix null handling
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in new issue
Block a user