From 06ecdf2af182034496e2123852deee4a58de1043 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 17 Oct 2021 02:52:05 +0200 Subject: making a shoebox --- src/app/constants.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/app/constants.js (limited to 'src/app/constants.js') 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", +}; -- cgit v1.2.3-70-g09d2