Types for new view calculation feature.

This commit is contained in:
Sam Rose 2024-09-02 15:28:20 +01:00
parent e2a355b4b1
commit bb8ba16b30
No known key found for this signature in database
1 changed files with 14 additions and 1 deletions

View File

@ -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<string, ViewUIFieldMetadata>
schema?: Record<string, ViewUIFieldMetadata | ViewCalculationFieldMetadata>
}
export type ViewSchema = ViewCountOrSumSchema | ViewStatisticsSchema