More types

This commit is contained in:
Adria Navarro 2024-03-26 10:04:51 +01:00
parent d431f633d3
commit 890059829f
2 changed files with 28 additions and 29 deletions

View File

@ -1,4 +1,4 @@
import { RelationshipType } from "constants/backend" import { RelationshipType } from "@budibase/types"
const typeMismatch = "Column type of the foreign key must match the primary key" const typeMismatch = "Column type of the foreign key must match the primary key"
const columnBeingUsed = "Column name cannot be an existing column" const columnBeingUsed = "Column name cannot be an existing column"

View File

@ -1,12 +1,12 @@
import { FieldType, FieldSubtype } from "@budibase/types" import {
FieldType,
FieldSubtype,
INTERNAL_TABLE_SOURCE_ID,
AutoFieldSubType,
Hosting,
} from "@budibase/types"
export const AUTO_COLUMN_SUB_TYPES = { export const AUTO_COLUMN_SUB_TYPES = AutoFieldSubType
AUTO_ID: "autoID",
CREATED_BY: "createdBy",
CREATED_AT: "createdAt",
UPDATED_BY: "updatedBy",
UPDATED_AT: "updatedAt",
}
export const AUTO_COLUMN_DISPLAY_NAMES = { export const AUTO_COLUMN_DISPLAY_NAMES = {
AUTO_ID: "Auto ID", AUTO_ID: "Auto ID",
@ -108,12 +108,20 @@ export const FIELDS = {
ATTACHMENT: { ATTACHMENT: {
name: "Attachment", name: "Attachment",
type: FieldType.ATTACHMENT, type: FieldType.ATTACHMENT,
icon: "Folder", icon: "Multiple",
constraints: { constraints: {
type: "array", type: "array",
presence: false, presence: false,
}, },
}, },
ATTACHMENT_SINGLE: {
name: "Attachment",
type: FieldType.ATTACHMENT_SINGLE,
icon: "Folder",
constraints: {
presence: false,
},
},
LINK: { LINK: {
name: "Relationship", name: "Relationship",
type: FieldType.LINK, type: FieldType.LINK,
@ -167,10 +175,7 @@ export const FILE_TYPES = {
DOCUMENT: ["odf", "docx", "doc", "pdf", "csv"], DOCUMENT: ["odf", "docx", "doc", "pdf", "csv"],
} }
export const HostingTypes = { export const HostingTypes = Hosting
CLOUD: "cloud",
SELF: "self",
}
export const Roles = { export const Roles = {
ADMIN: "ADMIN", ADMIN: "ADMIN",
@ -187,12 +192,6 @@ export function isAutoColumnUserRelationship(subtype) {
) )
} }
export const RelationshipType = {
MANY_TO_MANY: "many-to-many",
ONE_TO_MANY: "one-to-many",
MANY_TO_ONE: "many-to-one",
}
export const PrettyRelationshipDefinitions = { export const PrettyRelationshipDefinitions = {
MANY: "Many rows", MANY: "Many rows",
ONE: "One row", ONE: "One row",
@ -218,7 +217,7 @@ export const SWITCHABLE_TYPES = [
...ALLOWABLE_NUMBER_TYPES, ...ALLOWABLE_NUMBER_TYPES,
] ]
export const BUDIBASE_INTERNAL_DB_ID = "bb_internal" export const BUDIBASE_INTERNAL_DB_ID = INTERNAL_TABLE_SOURCE_ID
export const DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default" export const DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default"
export const BUDIBASE_DATASOURCE_TYPE = "budibase" export const BUDIBASE_DATASOURCE_TYPE = "budibase"
export const DB_TYPE_INTERNAL = "internal" export const DB_TYPE_INTERNAL = "internal"
@ -265,10 +264,10 @@ export const IntegrationNames = {
} }
export const SchemaTypeOptions = [ export const SchemaTypeOptions = [
{ label: "Text", value: "string" }, { label: "Text", value: FieldType.STRING },
{ label: "Number", value: "number" }, { label: "Number", value: FieldType.NUMBER },
{ label: "Boolean", value: "boolean" }, { label: "Boolean", value: FieldType.BOOLEAN },
{ label: "Datetime", value: "datetime" }, { label: "Datetime", value: FieldType.DATETIME },
] ]
export const SchemaTypeOptionsExpanded = SchemaTypeOptions.map(el => ({ export const SchemaTypeOptionsExpanded = SchemaTypeOptions.map(el => ({
@ -305,10 +304,10 @@ export const PaginationLocations = [
] ]
export const BannedSearchTypes = [ export const BannedSearchTypes = [
"link", FieldType.LINK,
"attachment", FieldType.ATTACHMENT,
"formula", FieldType.FORMULA,
"json", FieldType.JSON,
"jsonarray", "jsonarray",
"queryarray", "queryarray",
] ]