2014-05-18 07:21:27 -04:00
|
|
|
mongoose = require 'mongoose'
|
|
|
|
jsonschema = require '../../app/schemas/models/earned_achievement'
|
|
|
|
|
|
|
|
EarnedAchievementSchema = new mongoose.Schema({
|
|
|
|
notified:
|
|
|
|
type: Boolean
|
|
|
|
default: false
|
|
|
|
}, {strict:false})
|
|
|
|
|
2014-06-03 06:40:47 -04:00
|
|
|
EarnedAchievementSchema.pre 'save', (next) ->
|
|
|
|
@set('changed', Date.now())
|
|
|
|
next()
|
|
|
|
|
2014-05-19 19:25:41 -04:00
|
|
|
EarnedAchievementSchema.index({user: 1, achievement: 1}, {unique: true, name: 'earned achievement index'})
|
2014-05-24 14:45:53 -04:00
|
|
|
EarnedAchievementSchema.index({user: 1, changed: -1}, {name: 'latest '})
|
2014-05-19 19:25:41 -04:00
|
|
|
|
2014-06-03 06:40:47 -04:00
|
|
|
module.exports = EarnedAchievement = mongoose.model('EarnedAchievement', EarnedAchievementSchema)
|