diff --git a/src/config/constants.js b/src/config/constants.js index 304a435..8e66871 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -51,6 +51,8 @@ const CustomAttributeTypes = [ "Enumerable", ]; +const SublevelInventoryTypes = ["Inventory", "Material", "Item"]; + const AUTHENTICATION_FAILURE_ERROR_MESSAGE = "Authentication Failed!"; const AUTHORIZATION_FAILURE_ERROR_MESSAGE = "User not permitted due to lack of access!"; @@ -63,6 +65,7 @@ module.exports = { WarehouseScopes, InventoryTypes, CustomAttributeTypes, + SublevelInventoryTypes, SubLevelTypes, LevelPositions, SUPER_ADMIN_ROLE: "super-admin", diff --git a/src/models/Sublevel.js b/src/models/Sublevel.js index 9873d87..5da8c61 100644 --- a/src/models/Sublevel.js +++ b/src/models/Sublevel.js @@ -1,5 +1,5 @@ const mongoose = require("mongoose"); -const { SubLevelTypes, LevelPositions } = require("../config/constants"); +const { SubLevelTypes, LevelPositions, SublevelInventoryTypes } = require("../config/constants"); const schema = new mongoose.Schema( { @@ -57,10 +57,16 @@ const schema = new mongoose.Schema( default: false, }, preffered_inventory: [ - // { - // type: mongoose.Schema.Types.ObjectId, - // ref: "Inventory", - // }, + { + id: { + type: mongoose.Schema.Types.ObjectId, + refPath: "type", + }, + type: { + type: String, + enum: SublevelInventoryTypes, + }, + }, ], }, {