codecombat/server/campaigns/Campaign.coffee
Sébastien Moratinos 729cd300b7 server reorganize files and folder by features
- move and rename files
- use associative arrays which store handlers for 'dynamically'
  load module from de db route
- store models_path in test/server/common,
  a global model variable has the same name that the filename of the model
2014-01-23 01:01:40 +01:00

22 lines
600 B
CoffeeScript

mongoose = require('mongoose')
plugins = require('../plugins/plugins')
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)