From 7c6c03c80b2ad15944b6c830f1abc6fd213d7c8e Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Thu, 26 Sep 2024 15:32:21 +0100 Subject: [PATCH] Rename ViewUIFieldMetadata -> ViewFieldMetadata to match master. --- packages/server/src/api/controllers/view/viewsV2.ts | 12 ++++++------ packages/server/src/api/routes/tests/viewV2.spec.ts | 4 ++-- packages/server/src/db/linkedRows/index.ts | 4 ++-- packages/shared-core/src/helpers/views.ts | 10 +++++----- packages/types/src/documents/app/view.ts | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/server/src/api/controllers/view/viewsV2.ts b/packages/server/src/api/controllers/view/viewsV2.ts index fddcef97a2..7f6f638541 100644 --- a/packages/server/src/api/controllers/view/viewsV2.ts +++ b/packages/server/src/api/controllers/view/viewsV2.ts @@ -7,17 +7,17 @@ import { ViewResponse, ViewResponseEnriched, ViewV2, - BasicViewUIFieldMetadata, + BasicViewFieldMetadata, ViewCalculationFieldMetadata, RelationSchemaField, - ViewUIFieldMetadata, + ViewFieldMetadata, } from "@budibase/types" import { builderSocket, gridSocket } from "../../../websockets" import { helpers } from "@budibase/shared-core" function stripUnknownFields( - field: BasicViewUIFieldMetadata -): RequiredKeys { + field: BasicViewFieldMetadata +): RequiredKeys { if (helpers.views.isCalculationField(field)) { const strippedField: RequiredKeys = { order: field.order, @@ -31,7 +31,7 @@ function stripUnknownFields( } return strippedField } else { - const strippedField: RequiredKeys = { + const strippedField: RequiredKeys = { order: field.order, width: field.width, visible: field.visible, @@ -83,7 +83,7 @@ async function parseSchema(view: CreateViewRequest) { p[fieldName] = fieldSchema return p - }, {} as Record>) + }, {} as Record>) return finalViewSchema } diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index 883b25aca1..3712efa5a4 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -22,7 +22,7 @@ import { RelationshipType, TableSchema, RenameColumn, - ViewUIFieldMetadata, + ViewFieldMetadata, FeatureFlag, BBReferenceFieldSubType, } from "@budibase/types" @@ -1154,7 +1154,7 @@ describe.each([ const createView = async ( tableId: string, - schema: Record + schema: Record ) => await config.api.viewV2.create({ name: generator.guid(), diff --git a/packages/server/src/db/linkedRows/index.ts b/packages/server/src/db/linkedRows/index.ts index ed660288c8..41cbc5b9c1 100644 --- a/packages/server/src/db/linkedRows/index.ts +++ b/packages/server/src/db/linkedRows/index.ts @@ -20,7 +20,7 @@ import { Row, Table, TableSchema, - ViewUIFieldMetadata, + ViewFieldMetadata, ViewV2, } from "@budibase/types" import sdk from "../../sdk" @@ -263,7 +263,7 @@ export async function squashLinks( FeatureFlag.ENRICHED_RELATIONSHIPS ) - let viewSchema: Record = {} + let viewSchema: Record = {} if (sdk.views.isView(source)) { if (helpers.views.isCalculationView(source)) { return enriched diff --git a/packages/shared-core/src/helpers/views.ts b/packages/shared-core/src/helpers/views.ts index c65bc4882d..f41c66adc8 100644 --- a/packages/shared-core/src/helpers/views.ts +++ b/packages/shared-core/src/helpers/views.ts @@ -1,20 +1,20 @@ import { - BasicViewUIFieldMetadata, + BasicViewFieldMetadata, ViewCalculationFieldMetadata, - ViewUIFieldMetadata, + ViewFieldMetadata, ViewV2, } from "@budibase/types" import { pickBy } from "lodash" export function isCalculationField( - field: ViewUIFieldMetadata + field: ViewFieldMetadata ): field is ViewCalculationFieldMetadata { return "calculationType" in field } export function isBasicViewField( - field: ViewUIFieldMetadata -): field is BasicViewUIFieldMetadata { + field: ViewFieldMetadata +): field is BasicViewFieldMetadata { return !isCalculationField(field) } diff --git a/packages/types/src/documents/app/view.ts b/packages/types/src/documents/app/view.ts index 74b8f61f59..a957564039 100644 --- a/packages/types/src/documents/app/view.ts +++ b/packages/types/src/documents/app/view.ts @@ -33,7 +33,7 @@ export interface View { groupBy?: string } -export interface BasicViewUIFieldMetadata extends UIFieldMetadata { +export interface BasicViewFieldMetadata extends UIFieldMetadata { readonly?: boolean columns?: Record } @@ -42,13 +42,13 @@ export interface RelationSchemaField extends UIFieldMetadata { readonly?: boolean } -export interface ViewCalculationFieldMetadata extends BasicViewUIFieldMetadata { +export interface ViewCalculationFieldMetadata extends BasicViewFieldMetadata { calculationType: CalculationType field: string } -export type ViewUIFieldMetadata = - | BasicViewUIFieldMetadata +export type ViewFieldMetadata = + | BasicViewFieldMetadata | ViewCalculationFieldMetadata export enum CalculationType { @@ -71,7 +71,7 @@ export interface ViewV2 { order?: SortOrder type?: SortType } - schema?: Record + schema?: Record } export type ViewSchema = ViewCountOrSumSchema | ViewStatisticsSchema