budibase/packages/server/src/constants/index.js

128 lines
2.7 KiB
JavaScript
Raw Normal View History

const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
const { UserStatus } = require("@budibase/auth").constants
const { ObjectStoreBuckets } = require("@budibase/auth").objectStore
2020-11-25 16:03:19 +01:00
2021-05-18 17:37:54 +02:00
exports.JobQueues = {
2021-05-18 22:03:26 +02:00
AUTOMATIONS: "automationQueue",
2021-05-18 17:37:54 +02:00
}
exports.FieldTypes = {
STRING: "string",
LONGFORM: "longform",
OPTIONS: "options",
NUMBER: "number",
BOOLEAN: "boolean",
ARRAY: "array",
DATETIME: "datetime",
ATTACHMENT: "attachment",
LINK: "link",
FORMULA: "formula",
AUTO: "auto",
JSON: "json",
}
2021-02-25 13:21:24 +01:00
exports.RelationshipTypes = {
ONE_TO_MANY: "one-to-many",
MANY_TO_ONE: "many-to-one",
2021-02-25 13:23:47 +01:00
MANY_TO_MANY: "many-to-many",
2021-02-25 13:21:24 +01:00
}
exports.AuthTypes = {
APP: "app",
BUILDER: "builder",
EXTERNAL: "external",
}
exports.DataSourceOperation = {
CREATE: "CREATE",
READ: "READ",
UPDATE: "UPDATE",
DELETE: "DELETE",
}
exports.SortDirection = {
ASCENDING: "ASCENDING",
DESCENDING: "DESCENDING",
}
exports.USERS_TABLE_SCHEMA = {
2020-11-25 16:03:19 +01:00
_id: "ta_users",
type: "table",
views: {},
name: "Users",
// TODO: ADMIN PANEL - when implemented this doesn't need to be carried out
2020-11-25 16:03:19 +01:00
schema: {
2020-12-04 13:22:45 +01:00
email: {
type: exports.FieldTypes.STRING,
2020-11-25 16:03:19 +01:00
constraints: {
type: exports.FieldTypes.STRING,
2020-12-04 13:22:45 +01:00
email: true,
2020-11-25 16:03:19 +01:00
length: {
maximum: "",
},
presence: true,
},
2020-12-04 13:22:45 +01:00
fieldName: "email",
name: "email",
2020-11-25 16:03:19 +01:00
},
firstName: {
name: "firstName",
fieldName: "firstName",
type: exports.FieldTypes.STRING,
constraints: {
type: exports.FieldTypes.STRING,
presence: false,
},
},
lastName: {
name: "lastName",
fieldName: "lastName",
type: exports.FieldTypes.STRING,
constraints: {
type: exports.FieldTypes.STRING,
presence: false,
},
},
roleId: {
fieldName: "roleId",
name: "roleId",
type: exports.FieldTypes.OPTIONS,
2020-11-25 16:03:19 +01:00
constraints: {
type: exports.FieldTypes.STRING,
2020-11-25 16:03:19 +01:00
presence: false,
inclusion: Object.values(BUILTIN_ROLE_IDS),
2020-11-25 16:03:19 +01:00
},
},
status: {
fieldName: "status",
name: "status",
type: exports.FieldTypes.OPTIONS,
constraints: {
type: exports.FieldTypes.STRING,
presence: false,
inclusion: Object.values(UserStatus),
},
},
2020-11-25 16:03:19 +01:00
},
2020-12-04 13:22:45 +01:00
primaryDisplay: "email",
2020-11-25 16:03:19 +01:00
}
exports.AutoFieldSubTypes = {
CREATED_BY: "createdBy",
CREATED_AT: "createdAt",
UPDATED_BY: "updatedBy",
UPDATED_AT: "updatedAt",
AUTO_ID: "autoID",
}
2021-05-24 23:39:13 +02:00
exports.OBJ_STORE_DIRECTORY = "/prod-budi-app-assets"
exports.BaseQueryVerbs = {
CREATE: "create",
READ: "read",
UPDATE: "update",
DELETE: "delete",
}
// pass through the list from the auth/core lib
exports.ObjectStoreBuckets = ObjectStoreBuckets