Added: Polymorphic preffered inventory

This commit is contained in:
Llewellyn D'souza
2021-12-29 15:19:17 +05:30
parent 4a577de9c5
commit 2f17ae2881
2 changed files with 14 additions and 5 deletions

View File

@@ -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",

View File

@@ -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,
},
},
],
},
{