From fe15b4d1e3bba9e6ea677803d53b73a9163e241b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 4 Oct 2023 13:06:57 +0200 Subject: [PATCH] Use types --- .../builder/src/constants/backend/index.js | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/builder/src/constants/backend/index.js b/packages/builder/src/constants/backend/index.js index 8b76207822..e0c4084814 100644 --- a/packages/builder/src/constants/backend/index.js +++ b/packages/builder/src/constants/backend/index.js @@ -1,7 +1,9 @@ +import { FieldType, FieldSubtype } from "@budibase/types" + export const FIELDS = { STRING: { name: "Text", - type: "string", + type: FieldType.STRING, icon: "Text", constraints: { type: "string", @@ -11,7 +13,7 @@ export const FIELDS = { }, BARCODEQR: { name: "Barcode/QR", - type: "barcodeqr", + type: FieldType.BARCODEQR, icon: "Camera", constraints: { type: "string", @@ -21,7 +23,7 @@ export const FIELDS = { }, LONGFORM: { name: "Long Form Text", - type: "longform", + type: FieldType.LONGFORM, icon: "TextAlignLeft", constraints: { type: "string", @@ -31,7 +33,7 @@ export const FIELDS = { }, OPTIONS: { name: "Options", - type: "options", + type: FieldType.OPTIONS, icon: "Dropdown", constraints: { type: "string", @@ -41,7 +43,7 @@ export const FIELDS = { }, ARRAY: { name: "Multi-select", - type: "array", + type: FieldType.ARRAY, icon: "Duplicate", constraints: { type: "array", @@ -51,7 +53,7 @@ export const FIELDS = { }, NUMBER: { name: "Number", - type: "number", + type: FieldType.NUMBER, icon: "123", constraints: { type: "number", @@ -61,12 +63,12 @@ export const FIELDS = { }, BIGINT: { name: "BigInt", - type: "bigint", + type: FieldType.BIGINT, icon: "TagBold", }, BOOLEAN: { name: "Boolean", - type: "boolean", + type: FieldType.BOOLEAN, icon: "Boolean", constraints: { type: "boolean", @@ -75,7 +77,7 @@ export const FIELDS = { }, DATETIME: { name: "Date/Time", - type: "datetime", + type: FieldType.DATETIME, icon: "Calendar", constraints: { type: "string", @@ -89,7 +91,7 @@ export const FIELDS = { }, ATTACHMENT: { name: "Attachment", - type: "attachment", + type: FieldType.ATTACHMENT, icon: "Folder", constraints: { type: "array", @@ -98,7 +100,7 @@ export const FIELDS = { }, LINK: { name: "Relationship", - type: "link", + type: FieldType.LINK, icon: "Link", constraints: { type: "array", @@ -107,13 +109,13 @@ export const FIELDS = { }, FORMULA: { name: "Formula", - type: "formula", + type: FieldType.FORMULA, icon: "Calculator", constraints: {}, }, JSON: { name: "JSON", - type: "json", + type: FieldType.JSON, icon: "Brackets", constraints: { type: "object", @@ -122,9 +124,9 @@ export const FIELDS = { }, BB_REFERENCE_USER: { name: "User", - type: "bb_reference", - subtype: "user", - compositeType: "bb_reference_user", // Used for working with the subtype on CreateEditColumn as is it was a primary type + type: FieldType.BB_REFERENCE, + subtype: FieldSubtype.USER, + compositeType: `${FieldType.BB_REFERENCE}_${FieldSubtype.USER}`, // Used for working with the subtype on CreateEditColumn as is it was a primary type icon: "User", }, }