2015-03-19 18:02:45 -04:00
|
|
|
c = require './../schemas'
|
|
|
|
|
2015-08-12 18:51:16 -04:00
|
|
|
PrepaidSchema = c.object({title: 'Prepaid', required: ['creator', 'type']}, {
|
2015-03-19 18:02:45 -04:00
|
|
|
creator: c.objectId(links: [ {rel: 'extra', href: '/db/user/{($)}'} ])
|
2015-08-13 13:57:47 -04:00
|
|
|
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/{($)}'} ])
|
2015-08-12 18:51:16 -04:00
|
|
|
maxRedeemers: { type: 'integer'}
|
2015-03-19 18:02:45 -04:00
|
|
|
code: c.shortString(title: "Unique code to redeem")
|
|
|
|
type: { type: 'string' }
|
|
|
|
properties: {type: 'object'}
|
|
|
|
})
|
|
|
|
|
|
|
|
c.extendBasicProperties(PrepaidSchema, 'prepaid')
|
|
|
|
|
|
|
|
module.exports = PrepaidSchema
|