Merge pull request #6 from kfnawaz/Feat-Item-association-model

Feat- Item association model
This commit is contained in:
Sathishkumar Krishnan
2021-12-23 18:14:51 +05:30
committed by GitHub

View File

@@ -0,0 +1,27 @@
const mongoose = require("mongoose");
const schema = new mongoose.Schema(
{
item_id: {
type: mongoose.Schema.Types.ObjectId,
ref: "Item",
},
sub_level_id: {
type: mongoose.Schema.Types.ObjectId,
ref: "Sublevel",
},
quantity: {
type: Number,
default: 0,
},
},
{
timestamps: true,
}
);
schema.index({ item_id: 1, sub_level_id: 1 }, { unique: 1 });
const ItemAssociation = mongoose.model("ItemAssociation", schema);
module.exports = ItemAssociation;