Merge pull request #14501 from Budibase/budi-8606-view-calculation-typing

Types for new view calculation feature.
This commit is contained in:
Michael Drury 2024-09-02 16:13:06 +01:00 committed by GitHub
commit 1005b83fd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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