diff options
Diffstat (limited to 'src/app/constants.js')
| -rw-r--r-- | src/app/constants.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/app/constants.js b/src/app/constants.js new file mode 100644 index 0000000..50aa57e --- /dev/null +++ b/src/app/constants.js @@ -0,0 +1,38 @@ +/** + * Constants and enums. + * @module app/constants + */ + +// Dotenv is loaded here for the benefit of command-line scripts +import dotenv from "dotenv"; +dotenv.config(); + +import { enumLookup } from "app/utils/data_utils"; + +// The Knex configuration file lives outside the main source tree. +export { default as knexfile } from "../../knexfile"; + +export const ROLE_ENUM = { + [-1]: "system", + 0: "guest", + 1: "analyst", + 2: "moderator", + 3: "admin", +}; + +export const ROLES = enumLookup(ROLE_ENUM); + +export const PERMISSIONS_ENUM = { + 0: "DENY", + 1: "ALLOW_FOR_OWNER", + 2: "ALLOW", +}; + +export const PERMISSIONS = enumLookup(PERMISSIONS_ENUM); + +export const CRUD_VERBS = { + get: "read", + post: "create", + put: "update", + delete: "destroy", +}; |
