codecombat/app/schemas/models/level_feedback.coffee

28 lines
769 B
CoffeeScript
Raw Normal View History

c = require './../schemas'
2014-04-12 04:35:56 -04:00
LevelFeedbackLevelSchema = c.object {required: ['original', 'majorVersion']}, {
original: c.objectId({})
2014-08-23 19:06:41 -04:00
majorVersion: {type: 'integer', minimum: 0 }}
2014-04-12 04:35:56 -04:00
LevelFeedbackSchema = c.object {
2014-06-30 22:16:26 -04:00
title: 'Feedback'
description: 'Feedback on a level.'
2014-04-12 04:35:56 -04:00
}
_.extend LevelFeedbackSchema.properties,
# denormalization
2014-06-30 22:16:26 -04:00
creatorName: {type: 'string'}
levelName: {type: 'string'}
levelID: {type: 'string'}
creator: c.objectId(links: [{rel: 'extra', href: '/db/user/{($)}'}])
created: c.date({title: 'Created', readOnly: true})
2014-04-12 04:35:56 -04:00
level: LevelFeedbackLevelSchema
2014-06-30 22:16:26 -04:00
rating: {type: 'number', minimum: 1, maximum: 5}
review: {type: 'string'}
2014-04-12 04:35:56 -04:00
c.extendBasicProperties LevelFeedbackSchema, 'level.feedback'
module.exports = LevelFeedbackSchema