This commit is contained in:
2019-07-17 03:21:49 -04:00
parent d5b34dc81f
commit 77f836842b
10 changed files with 145 additions and 4 deletions

View File

@@ -1,7 +1,9 @@
const config = require('../config.js');
const mongoose = require('mongoose');
const timestamps = require('mongoose-timestamp');
const config = require('../config.js');
const Item = require('./item');
const PostSchema = new mongoose.Schema(
{
author: String,
@@ -133,7 +135,11 @@ const EventSchema = new mongoose.Schema(
EventSchema.plugin(timestamps);
EventSchema.path('images').get(v => `${config.assetStoreUrl}${v.url}`)
EventSchema.path('images').get(v => `${config.assetStoreUrl}${v.url}`);
EventSchema.methods.getEventAuctionItems = function(callback = () => {}) {
return Item.getAuctionItemsByEvent(this.id, callback);
};
const Event = mongoose.model('Event', EventSchema);
module.exports = Event;