-
Notifications
You must be signed in to change notification settings - Fork 1
WebApiFilter
Niels Steenbeek edited this page Mar 24, 2020
·
5 revisions
The Filter interface wraps the complex, hard to read and hard to write $filter.
It uses Condition.
type FilterType = 'and' | 'or' | 'not';
export interface Filter {
type?: FilterType;
conditions: Condition[];
filters?: Filter[];
}
const filters: Filter[] = [{
conditions: [{
attribute: 'name',
value: 'accountName'
}]
}],
nrAccounts = await AccountService.count(filters);
const filters: Filter[] = [{
type: 'or',
conditions: [{
attribute: 'name',
value: 'accountName'
}, {
attribute: 'description',
value: 'some description'
}]
}],
nrAccounts = await AccountService.count(filters);
const filters: Filter[] = [{
conditions: [{
attribute: 'name',
value: 'accountName'
}]
}, {
conditions: [{
attribute: 'description',
value: 'some description'
}]
}]
nrAccounts = await AccountService.count(filters);
const filters: Filter[] = [{
conditions: [{
attribute: 'name',
value: 'accountName'
}],
filters: [{
conditions: [{
attribute: 'description',
value: 'some description'
}]
}]
}],
nrAccounts = await AccountService.count(filters);