diff --git a/src/config/constants.js b/src/config/constants.js index 7373070..6ccf7a5 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -40,17 +40,19 @@ const CustomAttributeTypes = [ "Enumerable", ]; -const AUTHENTICATION_FAILURE_ERROR_MESSAGE = - "Authentication Failed!"; +const AUTHENTICATION_FAILURE_ERROR_MESSAGE = "Authentication Failed!"; const AUTHORIZATION_FAILURE_ERROR_MESSAGE = "User not permitted due to lack of access!"; +const SubLevelTypes = ["POSITION", "BIN", "PALLET"]; + module.exports = { UserActions, InventoryScopes, WarehouseScopes, InventoryTypes, CustomAttributeTypes, + SubLevelTypes, SUPER_ADMIN_ROLE: "super-admin", COMPANY_ADMIN_ROLE: "company-admin", WAREHOUSE_ADMIN_ROLE: "warehouse-admin", diff --git a/src/models/Level.js b/src/models/Level.js index 43b04c0..debc961 100644 --- a/src/models/Level.js +++ b/src/models/Level.js @@ -1,4 +1,5 @@ const mongoose = require("mongoose"); +const { SubLevelTypes } = require("../config/constants"); const schema = new mongoose.Schema( { @@ -26,7 +27,7 @@ const schema = new mongoose.Schema( type: { required: true, type: String, - enum: ["POSITION", "BIN", "PALLET"], // TODO: Add to constant file + enum: SubLevelTypes }, depth: { required: true, diff --git a/src/models/Sublevel.js b/src/models/Sublevel.js index d5aeeff..172e538 100644 --- a/src/models/Sublevel.js +++ b/src/models/Sublevel.js @@ -1,4 +1,5 @@ const mongoose = require("mongoose"); +const { SubLevelTypes } = require("../config/constants"); const schema = new mongoose.Schema( { @@ -10,7 +11,7 @@ const schema = new mongoose.Schema( type: { type: String, required: true, - enum: ["POSITION", "BIN", "PALLET"], // TODO: Add to constant file + enum: SubLevelTypes }, specs: { // TBD @@ -36,7 +37,7 @@ const schema = new mongoose.Schema( type: { required: true, type: String, - enum: ["POSITION", "BIN", "PALLET"], + enum: SubLevelTypes, }, depth: { required: true, @@ -70,3 +71,4 @@ const schema = new mongoose.Schema( const Sublevel = mongoose.model("Sublevel", schema); module.exports = Sublevel; +