codecombat/app/schemas/models/prepaid.schema.coffee
Matt Lott 9c39bf7656 Update prepaids to support multiple redeemers for a single code
Will remove deprecated properties after updating production.
2015-08-12 15:51:18 -07:00

17 lines
646 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 {}, 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'}
# Deprecated
status: { enum: ['active', 'used'], default: 'active' }
redeemer: c.objectId(links: [ {rel: 'extra', href: '/db/user/{($)}'} ])
})
c.extendBasicProperties(PrepaidSchema, 'prepaid')
module.exports = PrepaidSchema