From 2f6a90ee14d0dee7a8825dfffa68e590749d94e6 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Tue, 25 May 2021 14:30:45 -0400 Subject: [PATCH] Add new aggregation types to query type --- api/src/types/query.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/api/src/types/query.ts b/api/src/types/query.ts index b93d113bf2..60705d1063 100644 --- a/api/src/types/query.ts +++ b/api/src/types/query.ts @@ -10,6 +10,8 @@ export type Query = { meta?: Meta[]; search?: string; export?: 'json' | 'csv' | 'xml'; + group?: string[]; + aggregate?: Aggregate; deep?: Record; }; @@ -22,6 +24,27 @@ export type Filter = { [keyOrOperator: string]: Filter | any; }; +/** + * Aggregate operation. Contains column name, and the field alias it should be returned as + */ +export type Aggregate = { + avg?: { + [column: string]: string; + }; + min?: { + [column: string]: string; + }; + max?: { + [column: string]: string; + }; + count?: { + [column: string]: string; + }; + sum?: { + [column: string]: string; + }; +}; + export type FilterOperator = | 'eq' | 'neq'