budibase/packages/builder/src/constants/backend/index.js

231 lines
4.4 KiB
JavaScript
Raw Normal View History

2020-06-15 17:41:31 +02:00
export const FIELDS = {
PLAIN_TEXT: {
name: "Plain Text",
icon: "ri-text",
2020-06-16 21:29:18 +02:00
type: "string",
constraints: {
2020-06-15 17:41:31 +02:00
type: "string",
2020-06-16 21:29:18 +02:00
length: {},
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
2020-06-15 17:41:31 +02:00
},
},
NUMBER: {
name: "Number",
icon: "ri-number-1",
2020-06-16 21:29:18 +02:00
type: "number",
constraints: {
2020-06-15 17:41:31 +02:00
type: "number",
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
2020-06-16 21:29:18 +02:00
numericality: {},
2020-06-15 17:41:31 +02:00
},
},
BOOLEAN: {
name: "True/False",
icon: "ri-toggle-line",
2020-06-16 21:29:18 +02:00
type: "boolean",
constraints: {
2020-06-15 17:41:31 +02:00
type: "boolean",
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
2020-06-15 17:41:31 +02:00
},
},
2020-06-22 22:30:23 +02:00
// OPTIONS: {
// name: "Options",
// icon: "ri-list-check-2",
// type: "options",
// constraints: {
// type: "string",
2020-07-19 18:21:52 +02:00
// presence: { allowEmpty: true },
2020-06-22 22:30:23 +02:00
// },
// },
2020-06-18 18:55:46 +02:00
DATETIME: {
name: "Date/Time",
icon: "ri-calendar-event-fill",
2020-06-25 15:36:27 +02:00
type: "string",
2020-06-18 18:55:46 +02:00
constraints: {
2020-06-25 15:36:27 +02:00
type: "string",
length: {},
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
2020-06-18 18:55:46 +02:00
},
},
2020-06-22 22:30:23 +02:00
// IMAGE: {
// name: "File",
// icon: "ri-image-line",
// type: "file",
// constraints: {
// type: "string",
2020-07-19 18:21:52 +02:00
// presence: { allowEmpty: true },
2020-06-22 22:30:23 +02:00
// },
// },
// FILE: {
// name: "Image",
// icon: "ri-file-line",
// type: "file",
// constraints: {
// type: "string",
2020-07-19 18:21:52 +02:00
// presence: { allowEmpty: true },
2020-06-22 22:30:23 +02:00
// },
// },
LINKED_FIELDS: {
name: "Linked Fields",
2020-06-18 18:55:46 +02:00
icon: "ri-link",
type: "link",
modelId: null,
constraints: {
type: "array",
},
},
2020-06-15 17:41:31 +02:00
}
export const BLOCKS = {
NAME: {
name: "Name",
icon: "ri-text",
type: "string",
constraints: {
type: "string",
length: {},
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
},
},
COMPANY: {
name: "Company",
icon: "ri-store-line",
type: "string",
constraints: {
type: "string",
length: {},
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
},
},
EMAIL: {
name: "Email",
icon: "ri-mail-line",
type: "string",
constraints: {
type: "string",
length: {},
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
},
},
PHONE_NUMBER: {
name: "Phone No.",
icon: "ri-phone-line",
type: "number",
constraints: {
type: "number",
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
numericality: {},
},
},
VALUE: {
name: "Value",
icon: "ri-number-5",
type: "number",
constraints: {
type: "number",
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
numericality: {},
},
},
ACTIVE: {
name: "Active",
icon: "ri-toggle-line",
type: "boolean",
constraints: {
type: "boolean",
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
},
},
URL: {
name: "URL",
icon: "ri-link",
type: "string",
constraints: {
type: "string",
length: {},
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
},
},
IMAGE: {
name: "Image URL",
icon: "ri-image-line",
type: "string",
constraints: {
type: "string",
length: {},
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
},
},
2020-06-22 22:30:23 +02:00
// PRIORITY: {
// name: "Options",
// icon: "ri-list-check-2",
// type: "options",
// constraints: {
// type: "string",
2020-07-19 18:21:52 +02:00
// presence: { allowEmpty: true },
2020-06-22 22:30:23 +02:00
// inclusion: ["low", "medium", "high"],
// },
// },
END_DATE: {
name: "End Date",
icon: "ri-calendar-event-fill",
2020-06-25 15:36:27 +02:00
type: "string",
constraints: {
2020-06-25 15:36:27 +02:00
type: "string",
length: {},
2020-07-19 18:21:52 +02:00
presence: { allowEmpty: true },
},
},
2020-06-22 22:30:23 +02:00
// AVATAR: {
// name: "Avatar",
// icon: "ri-image-line",
// type: "image",
// constraints: {
// type: "string",
2020-07-19 18:21:52 +02:00
// presence: { allowEmpty: true },
2020-06-22 22:30:23 +02:00
// },
// },
// PDF: {
// name: "PDF",
// icon: "ri-file-line",
// type: "file",
// constraints: {
// type: "string",
2020-07-19 18:21:52 +02:00
// presence: { allowEmpty: true },
2020-06-22 22:30:23 +02:00
// },
// },
2020-06-15 17:41:31 +02:00
}
export const MODELS = {
CONTACTS: {
2020-06-22 22:30:23 +02:00
icon: "ri-contacts-book-line",
name: "Contacts",
schema: {
Name: BLOCKS.NAME,
2020-06-18 18:55:46 +02:00
"Phone Number": BLOCKS.PHONE_NUMBER,
},
},
RECIPES: {
icon: "ri-link",
name: "Recipes",
schema: {
Name: BLOCKS.NAME,
2020-06-22 22:30:23 +02:00
Cuisine: {
...FIELDS.PLAIN_TEXT,
2020-06-23 17:20:06 +02:00
name: "Cuisine",
2020-06-22 22:30:23 +02:00
},
},
},
SPORTS_TEAM: {
icon: "ri-basketball-line",
name: "Sports Team",
schema: {
Name: BLOCKS.NAME,
Championships: {
...FIELDS.NUMBER,
2020-06-23 17:20:06 +02:00
name: "Championships",
},
2020-06-18 18:55:46 +02:00
},
},
}