diff --git a/src/config/constants.js b/src/config/constants.js index 6ccf7a5..93c794b 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -12,6 +12,36 @@ const UserActions = [ "Receive", ]; +const LevelPositions = [ + "B", + "D", + "DB", + "DF", + "F", + "L", + "LB", + "LD", + "LDB", + "LDF", + "LF", + "LU", + "LUB", + "LUF", + "R", + "RB", + "RD", + "RDB", + "RDF", + "RF", + "RU", + "RUB", + "RUF", + "U", + "UB", + "UF", + "W", +]; + const InventoryScopes = ["Inventory", "Material", "Item"]; const WarehouseScopes = [ @@ -53,6 +83,7 @@ module.exports = { InventoryTypes, CustomAttributeTypes, SubLevelTypes, + LevelPositions, 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 debc961..857b561 100644 --- a/src/models/Level.js +++ b/src/models/Level.js @@ -1,5 +1,5 @@ const mongoose = require("mongoose"); -const { SubLevelTypes } = require("../config/constants"); +const { SubLevelTypes, LevelPositions } = require("../config/constants"); const schema = new mongoose.Schema( { @@ -29,15 +29,10 @@ const schema = new mongoose.Schema( type: String, enum: SubLevelTypes }, - depth: { + postition: { required: true, - type: Number, - min: 1, // Level is at 0 - max: 5, - }, - bay_id: { - type: mongoose.Schema.Types.ObjectId, - ref: "Bay", + type: String, + enum: LevelPositions, }, sub_level_id: { required: true, diff --git a/src/models/Sublevel.js b/src/models/Sublevel.js index 7d0dbe0..1334ae6 100644 --- a/src/models/Sublevel.js +++ b/src/models/Sublevel.js @@ -1,5 +1,5 @@ const mongoose = require("mongoose"); -const { SubLevelTypes } = require("../config/constants"); +const { SubLevelTypes, LevelPositions } = require("../config/constants"); const schema = new mongoose.Schema( { @@ -11,7 +11,7 @@ const schema = new mongoose.Schema( type: { type: String, required: true, - enum: SubLevelTypes + enum: SubLevelTypes, }, specs: { // TBD @@ -39,11 +39,10 @@ const schema = new mongoose.Schema( type: String, enum: SubLevelTypes, }, - depth: { + postition: { required: true, - type: Number, - min: 1, // Level is at 0 - max: 5, + type: String, + enum: LevelPositions, }, sub_level_id: { required: true,