From de4c365615da80031d05ac0a6506355986cc689a Mon Sep 17 00:00:00 2001 From: Llewellyn D'souza Date: Wed, 22 Dec 2021 16:45:38 +0530 Subject: [PATCH] Added: Item association model --- src/models/ItemAssociation.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/models/ItemAssociation.js diff --git a/src/models/ItemAssociation.js b/src/models/ItemAssociation.js new file mode 100644 index 0000000..84ebc83 --- /dev/null +++ b/src/models/ItemAssociation.js @@ -0,0 +1,25 @@ +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, + } +); + +const ItemAssociation = mongoose.model("ItemAssociation", schema); + +module.exports = ItemAssociation;