| 1 | export enum ConditionType { |
| 2 | NESTED = 'nested', |
| 3 | SINGLE = 'single', |
| 4 | } |
| 5 | |
| 6 | export interface BaseCondition { |
| 7 | type: ConditionType |
| 8 | } |
| 9 | |
| 10 | export enum Operator { |
| 11 | EQUAL = '=', |
| 12 | NOT_EQUAL = '!=', |
| 13 | GREATER_THAN = '>', |
| 14 | LESS_THAN = '<', |
| 15 | GREATER_THAN_OR_EQUAL = '>=', |
| 16 | LESS_THAN_OR_EQUAL = '<=', |
| 17 | IN = 'in', |
| 18 | NOT_IN = 'not_in', |
| 19 | LIKE = 'like', |
| 20 | } |
| 21 | |
| 22 | export interface SingleCondition extends BaseCondition { |
| 23 | type: ConditionType.SINGLE |
| 24 | field: string |
| 25 | operator: Operator |
| 26 | value: string | string[] |
| 27 | } |
| 28 | export type Condition = SingleCondition | NestedCondition |
| 29 | |
| 30 | export interface NestedCondition extends BaseCondition { |
| 31 | type: ConditionType.NESTED |
| 32 | conjunction: 'AND' | 'OR' |
| 33 | conditions: Condition[] |
| 34 | } |
| 35 | export type FilterSet = NestedCondition |
| 36 | |
| 37 | export const DB_CONNECTION_NAME = 'channel-db-connection' |
| 38 |