summaryrefslogtreecommitdiff
path: root/src/app/constants.js
blob: 50aa57e6127e821446ef6fa3667ccec005d1e3d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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",
};