2014-01-03 13:32:13 -05:00
|
|
|
mongoose = require('mongoose')
|
2014-01-22 17:57:41 -05:00
|
|
|
plugins = require('../plugins/plugins')
|
2014-01-03 13:32:13 -05:00
|
|
|
|
|
|
|
NestedLevelSchema = new mongoose.Schema(
|
|
|
|
name: String
|
|
|
|
description: String
|
|
|
|
thumbnail: Buffer
|
|
|
|
original: {type: mongoose.Schema.ObjectId, ref: 'level'}
|
|
|
|
majorVersion: Number
|
|
|
|
)
|
|
|
|
|
|
|
|
CampaignSchema = new mongoose.Schema(
|
|
|
|
description: String
|
|
|
|
levels: [NestedLevelSchema]
|
|
|
|
)
|
|
|
|
|
|
|
|
CampaignSchema.plugin(plugins.NamedPlugin)
|
|
|
|
CampaignSchema.plugin(plugins.PermissionsPlugin)
|
|
|
|
CampaignSchema.plugin(plugins.SearchablePlugin, {searchable: ['name', 'description']})
|
|
|
|
|
|
|
|
module.exports = Campaign = mongoose.model('campaign', CampaignSchema)
|
|
|
|
|