Files
quarksBot/structures/inventory.js
T

33 lines
844 B
JavaScript

const mongoose = require('mongoose');
let inventorySchema = mongoose.Schema({
inventory: {
userID: String,
items: [],
lastWork: Date,
}
});
inventorySchema.methods.createInventory = function (userID) {
this.inventory.userID = userID;
this.inventory.items = [];
let walletData = {
name: 'Wallet',
type: 'wallet',
description: '`/inventory wallet` to view wallet',
cash: 0.00,
ID: {
firstname: '',
lastname: '',
dob: ''
}
}
this.inventory.items.push(walletData);
this.inventory.lastWork = new Date('2000-01-01T00:00:00'); // garantee's they can work right after inventory create
};
inventorySchema.methods.addItem = function (item) {
this.inventory.items.push(item);
};
module.exports = mongoose.model('Inventory', inventorySchema);