Added: Polymorphic preffered inventory
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user