codecombat/app/schemas/models/prepaid.schema.coffee
2015-08-13 11:13:15 -07:00

17 lines
644 B
CoffeeScript

c = require './../schemas'
PrepaidSchema = c.object({title: 'Prepaid', required: ['creator', 'type']}, {
creator: c.objectId(links: [ {rel: 'extra', href: '/db/user/{($)}'} ])
redeemers: c.array {title: 'Users who have redeemed this code'},
c.object {required: ['date', 'userID']},
date: c.date {title: 'Redeemed date'}
userID: c.objectId(links: [ {rel: 'extra', href: '/db/user/{($)}'} ])
maxRedeemers: { type: 'integer'}
code: c.shortString(title: "Unique code to redeem")
type: { type: 'string' }
properties: {type: 'object'}
})
c.extendBasicProperties(PrepaidSchema, 'prepaid')
module.exports = PrepaidSchema