mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-25 16:47:58 -05:00
21 lines
664 B
CoffeeScript
21 lines
664 B
CoffeeScript
|
c = require './../schemas'
|
||
|
|
||
|
purchaseables = ['level', 'thang_type']
|
||
|
|
||
|
PurchaseSchema = c.object({title: 'Purchase', required: ['purchaser', 'recipient', 'purchased']}, {
|
||
|
purchaser: c.objectId(links: [
|
||
|
{rel: 'extra', href: '/db/user/{($)}'}
|
||
|
]) # in case of gifts
|
||
|
recipient: c.objectId(links: [
|
||
|
{rel: 'extra', href: '/db/user/{($)}'}
|
||
|
])
|
||
|
purchased: c.object({title: 'Target', required: ['collection', 'original']}, {
|
||
|
collection: {enum: purchaseables}
|
||
|
original: c.objectId(title: 'Target Original')
|
||
|
})
|
||
|
created: c.date({title: 'Created', readOnly: true})
|
||
|
})
|
||
|
|
||
|
c.extendBasicProperties(PurchaseSchema, 'patch')
|
||
|
|
||
|
module.exports = PurchaseSchema
|