(
filters: BaseQueryFilters = {},
options: QueryOptions = {}
)
| 176 | } |
| 177 | |
| 178 | export function getTelemetryFilterQuery( |
| 179 | filters: BaseQueryFilters = {}, |
| 180 | options: QueryOptions = {} |
| 181 | ) { |
| 182 | const query = Object.keys(filters).reduce<string[]>((arr, name) => { |
| 183 | const value: any = filters[name as keyof BaseQueryFilters]; |
| 184 | const operator = value?.filter ?? OPERATORS.equals; |
| 185 | const column = get(FILTER_COLUMNS, name, options?.columns?.[name]); |
| 186 | |
| 187 | // TODO |
| 188 | |
| 189 | if (value !== undefined && column) { |
| 190 | arr.push(`AND ${mapFilter(column, operator, name)}`); |
| 191 | } |
| 192 | |
| 193 | return arr; |
| 194 | }, []); |
| 195 | |
| 196 | return Prisma.sql([query.join('\n')]); |
| 197 | } |
| 198 | |
| 199 | function mapFilter( |
| 200 | column: string, |
no test coverage detected