Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { Schema, model } = require('mongoose');
- const itemSchema = new Schema({
- name: {
- type: String,
- required: true,
- },
- description: { type: String, required: true },
- });
- const Item = model('Item', itemSchema);
- module.exports = Item;
- const { Schema } = require('mongoose');
- // eslint-disable-next-line no-unused-vars
- const Item = require('./item-schema');
- const inventoryItemSchema = new Schema({
- item: { type: Schema.Types.ObjectId, ref: 'Item', required: true },
- quantity: { type: Number, default: 0 },
- });
- module.exports = inventoryItemSchema;
- const { Schema, model } = require('mongoose');
- const inventoryItemSchema = require('./inventoryItemSchema');
- const inventorySchema = new Schema({
- player: { type: String, ref: 'structureSchema', required: true },
- items: [inventoryItemSchema],
- });
- const Inventory = model('Inventory', inventorySchema);
- module.exports = Inventory;
Advertisement
Add Comment
Please, Sign In to add comment