From bb8ba16b3041e89216563c20b528d67147808532 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 2 Sep 2024 15:28:20 +0100 Subject: [PATCH] Types for new view calculation feature. --- packages/types/src/documents/app/view.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/types/src/documents/app/view.ts b/packages/types/src/documents/app/view.ts index 2572ddba5d..24dad0bcca 100644 --- a/packages/types/src/documents/app/view.ts +++ b/packages/types/src/documents/app/view.ts @@ -37,6 +37,19 @@ export type ViewUIFieldMetadata = UIFieldMetadata & { readonly?: boolean } +export enum CalculationType { + SUM = "sum", + AVG = "avg", + COUNT = "count", + MIN = "min", + MAX = "max", +} + +export type ViewCalculationFieldMetadata = ViewUIFieldMetadata & { + calculationType: CalculationType + field: string +} + export interface ViewV2 { version: 2 id: string @@ -49,7 +62,7 @@ export interface ViewV2 { order?: SortOrder type?: SortType } - schema?: Record + schema?: Record } export type ViewSchema = ViewCountOrSumSchema | ViewStatisticsSchema