2020-12-02 14:20:56 +01:00
|
|
|
const { BUILTIN_ROLE_IDS } = require("../utilities/security/roles")
|
2021-04-21 17:42:44 +02:00
|
|
|
const { UserStatus } = require("@budibase/auth").constants
|
2021-05-06 20:27:24 +02:00
|
|
|
const { ObjectStoreBuckets } = require("@budibase/auth").objectStore
|
2020-11-25 16:03:19 +01:00
|
|
|
|
2021-04-01 15:11:58 +02:00
|
|
|
exports.LOGO_URL =
|
|
|
|
"https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg"
|
|
|
|
|
2021-02-22 12:39:58 +01:00
|
|
|
exports.FieldTypes = {
|
|
|
|
STRING: "string",
|
|
|
|
LONGFORM: "longform",
|
|
|
|
OPTIONS: "options",
|
|
|
|
NUMBER: "number",
|
|
|
|
BOOLEAN: "boolean",
|
|
|
|
DATETIME: "datetime",
|
|
|
|
ATTACHMENT: "attachment",
|
|
|
|
LINK: "link",
|
2021-04-29 20:06:58 +02:00
|
|
|
FORMULA: "formula",
|
2021-02-22 12:39:58 +01:00
|
|
|
AUTO: "auto",
|
|
|
|
}
|
|
|
|
|
2021-02-25 13:21:24 +01:00
|
|
|
exports.RelationshipTypes = {
|
|
|
|
ONE_TO_MANY: "one-to-many",
|
2021-03-01 18:06:08 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-02-22 12:39:58 +01:00
|
|
|
exports.AuthTypes = {
|
2020-10-13 22:33:56 +02:00
|
|
|
APP: "app",
|
|
|
|
BUILDER: "builder",
|
|
|
|
EXTERNAL: "external",
|
|
|
|
}
|
|
|
|
|
2021-02-22 12:39:58 +01:00
|
|
|
exports.USERS_TABLE_SCHEMA = {
|
2020-11-25 16:03:19 +01:00
|
|
|
_id: "ta_users",
|
|
|
|
type: "table",
|
|
|
|
views: {},
|
|
|
|
name: "Users",
|
2021-04-19 17:26:33 +02:00
|
|
|
// 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: {
|
2021-02-22 12:39:58 +01:00
|
|
|
type: exports.FieldTypes.STRING,
|
2020-11-25 16:03:19 +01:00
|
|
|
constraints: {
|
2021-02-22 12:39:58 +01:00
|
|
|
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
|
|
|
},
|
2020-12-02 14:20:56 +01:00
|
|
|
roleId: {
|
|
|
|
fieldName: "roleId",
|
|
|
|
name: "roleId",
|
2021-02-22 12:39:58 +01:00
|
|
|
type: exports.FieldTypes.OPTIONS,
|
2020-11-25 16:03:19 +01:00
|
|
|
constraints: {
|
2021-02-22 12:39:58 +01:00
|
|
|
type: exports.FieldTypes.STRING,
|
2020-11-25 16:03:19 +01:00
|
|
|
presence: false,
|
2020-12-08 13:20:37 +01:00
|
|
|
inclusion: Object.values(BUILTIN_ROLE_IDS),
|
2020-11-25 16:03:19 +01:00
|
|
|
},
|
|
|
|
},
|
2021-02-22 13:29:49 +01:00
|
|
|
status: {
|
|
|
|
fieldName: "status",
|
|
|
|
name: "status",
|
|
|
|
type: exports.FieldTypes.OPTIONS,
|
2021-02-22 12:39:58 +01:00
|
|
|
constraints: {
|
2021-02-22 13:29:49 +01:00
|
|
|
type: exports.FieldTypes.STRING,
|
2021-02-22 12:39:58 +01:00
|
|
|
presence: false,
|
2021-04-08 17:58:33 +02:00
|
|
|
inclusion: Object.values(UserStatus),
|
2021-02-22 12:39:58 +01:00
|
|
|
},
|
|
|
|
},
|
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
|
|
|
}
|
|
|
|
|
2021-02-15 18:47:14 +01:00
|
|
|
exports.AutoFieldSubTypes = {
|
|
|
|
CREATED_BY: "createdBy",
|
|
|
|
CREATED_AT: "createdAt",
|
|
|
|
UPDATED_BY: "updatedBy",
|
|
|
|
UPDATED_AT: "updatedAt",
|
|
|
|
AUTO_ID: "autoID",
|
|
|
|
}
|
|
|
|
|
2021-02-01 19:08:06 +01:00
|
|
|
exports.OBJ_STORE_DIRECTORY = "/app-assets/assets"
|
2021-02-05 17:45:23 +01:00
|
|
|
exports.BaseQueryVerbs = {
|
|
|
|
CREATE: "create",
|
|
|
|
READ: "read",
|
|
|
|
UPDATE: "update",
|
|
|
|
DELETE: "delete",
|
|
|
|
}
|
2021-03-19 20:07:47 +01:00
|
|
|
|
2021-05-06 20:27:24 +02:00
|
|
|
// pass through the list from the auth/core lib
|
|
|
|
exports.ObjectStoreBuckets = ObjectStoreBuckets
|