From 6bc658c1ff0e74094299b59f72c63c8e4a28fe4b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 18 Jan 2023 11:50:00 +0000 Subject: [PATCH] Fix types --- packages/server/src/constants/index.ts | 18 +----------------- .../db/defaultData/datasource_bb_default.ts | 8 ++++---- packages/server/src/integrations/oracle.ts | 2 +- .../src/tests/utilities/TestConfiguration.ts | 4 ++-- packages/types/src/documents/app/row.ts | 1 + 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/packages/server/src/constants/index.ts b/packages/server/src/constants/index.ts index eb4c6211c6..ef933769b1 100644 --- a/packages/server/src/constants/index.ts +++ b/packages/server/src/constants/index.ts @@ -1,4 +1,5 @@ import { objectStore, roles, constants } from "@budibase/backend-core" +export { FieldType as FieldTypes } from "@budibase/types" export enum FilterTypes { STRING = "string", @@ -22,23 +23,6 @@ export const NoEmptyFilterStrings = [ FilterTypes.NOT_CONTAINS, ] -export enum FieldTypes { - STRING = "string", - BARCODEQR = "barcodeqr", - LONGFORM = "longform", - OPTIONS = "options", - NUMBER = "number", - BOOLEAN = "boolean", - ARRAY = "array", - DATETIME = "datetime", - ATTACHMENT = "attachment", - LINK = "link", - FORMULA = "formula", - AUTO = "auto", - JSON = "json", - INTERNAL = "internal", -} - export const CanSwitchTypes = [ [exports.FieldTypes.JSON, exports.FieldTypes.ARRAY], [ diff --git a/packages/server/src/db/defaultData/datasource_bb_default.ts b/packages/server/src/db/defaultData/datasource_bb_default.ts index 027351139a..81d0488cda 100644 --- a/packages/server/src/db/defaultData/datasource_bb_default.ts +++ b/packages/server/src/db/defaultData/datasource_bb_default.ts @@ -190,7 +190,7 @@ export const DEFAULT_INVENTORY_TABLE_SCHEMA: Table = { }, } -export const DEFAULT_EMPLOYEE_TABLE_SCHEMA = { +export const DEFAULT_EMPLOYEE_TABLE_SCHEMA: Table = { _id: DEFAULT_EMPLOYEE_TABLE_ID, type: "internal", views: {}, @@ -287,7 +287,7 @@ export const DEFAULT_EMPLOYEE_TABLE_SCHEMA = { sortable: false, }, "Badge Photo": { - type: "attachment", + type: FieldTypes.ATTACHMENT, constraints: { type: FieldTypes.ARRAY, presence: false, @@ -466,7 +466,7 @@ export const DEFAULT_JOBS_TABLE_SCHEMA: Table = { // sortable: true, }, "Works End": { - type: "datetime", + type: FieldTypes.DATETIME, constraints: { type: "string", length: {}, @@ -480,7 +480,7 @@ export const DEFAULT_JOBS_TABLE_SCHEMA: Table = { ignoreTimezones: true, }, "Updated Price": { - type: "number", + type: FieldTypes.NUMBER, constraints: { type: "number", presence: false, diff --git a/packages/server/src/integrations/oracle.ts b/packages/server/src/integrations/oracle.ts index 9ec9c3f858..abf9bcbbe3 100644 --- a/packages/server/src/integrations/oracle.ts +++ b/packages/server/src/integrations/oracle.ts @@ -247,7 +247,7 @@ class OracleIntegration extends Sql implements DatasourcePlus { ) } - private internalConvertType(column: OracleColumn): { type: string } { + private internalConvertType(column: OracleColumn): { type: FieldTypes } { if (this.isBooleanType(column)) { return { type: FieldTypes.BOOLEAN } } diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index 03ed5ccee2..5fa7629d2a 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -373,11 +373,11 @@ class TestConfiguration { // clear any old app this.appId = null // @ts-ignore - await context.updateAppId(null) + context.updateAppId(null) this.app = await this._req({ name: appName }, null, controllers.app.create) this.appId = this.app.appId // @ts-ignore - await context.updateAppId(this.appId) + context.updateAppId(this.appId) // create production app this.prodApp = await this.publish() diff --git a/packages/types/src/documents/app/row.ts b/packages/types/src/documents/app/row.ts index b18c6ebee7..90c1e3fca8 100644 --- a/packages/types/src/documents/app/row.ts +++ b/packages/types/src/documents/app/row.ts @@ -14,6 +14,7 @@ export enum FieldType { AUTO = "auto", JSON = "json", INTERNAL = "internal", + BARCODEQR = "barcodeqr", } export interface RowAttachment {