This commit is contained in:
Scott Erickson 2015-01-08 11:28:52 -08:00
parent 68ed142bd6
commit d8e89f31b1
3 changed files with 3 additions and 3 deletions

View file

@ -27,7 +27,7 @@ module.exports =
triggeredBy: c.objectId() triggeredBy: c.objectId()
achievementName: type: 'string' achievementName: type: 'string'
created: type: 'date' created: type: 'date'
changed: type: 'date' changed: type: ['date', 'string', 'number'] # TODO: migrate timestamps and Date objects all to ISO strings
achievedAmount: type: 'number' achievedAmount: type: 'number'
earnedPoints: type: 'number' earnedPoints: type: 'number'
previouslyAchievedAmount: {type: 'number'} previouslyAchievedAmount: {type: 'number'}

View file

@ -10,7 +10,7 @@ EarnedAchievementSchema = new mongoose.Schema({
}, {strict:false}) }, {strict:false})
EarnedAchievementSchema.pre 'save', (next) -> EarnedAchievementSchema.pre 'save', (next) ->
@set('changed', Date.now()) @set('changed', new Date())
next() next()
EarnedAchievementSchema.index({user: 1, achievement: 1}, {unique: true, name: 'earned achievement index'}) EarnedAchievementSchema.index({user: 1, achievement: 1}, {unique: true, name: 'earned achievement index'})

View file

@ -23,7 +23,7 @@ LevelSessionSchema.post 'init', (doc) ->
LevelSessionSchema.pre 'save', (next) -> LevelSessionSchema.pre 'save', (next) ->
User = require '../../users/User' # Avoid mutual inclusion cycles User = require '../../users/User' # Avoid mutual inclusion cycles
@set('changed', new Date()) @set('changed', new Date().toISOString())
id = @get('id') id = @get('id')
initd = id of previous initd = id of previous