2014-04-12 13:51:02 -04:00
|
|
|
c = require './../schemas'
|
2014-04-08 22:26:19 -04:00
|
|
|
|
|
|
|
patchables = ['level', 'thang_type', 'level_system', 'level_component', 'article']
|
|
|
|
|
2014-04-10 16:09:44 -04:00
|
|
|
PatchSchema = c.object({title:'Patch', required:['target', 'delta', 'commitMessage']}, {
|
2014-04-08 22:26:19 -04:00
|
|
|
delta: { title: 'Delta', type:['array', 'object'] }
|
2014-04-10 16:09:44 -04:00
|
|
|
commitMessage: c.shortString({maxLength: 500, minLength: 1})
|
2014-04-08 22:26:19 -04:00
|
|
|
creator: c.objectId(links: [{rel: 'extra', href: "/db/user/{($)}"}])
|
|
|
|
created: c.date( { title: 'Created', readOnly: true })
|
|
|
|
status: { enum: ['pending', 'accepted', 'rejected', 'withdrawn']}
|
|
|
|
|
|
|
|
target: c.object({title: 'Target', required:['collection', 'id']}, {
|
|
|
|
collection: { enum: patchables }
|
|
|
|
id: c.objectId(title: 'Target ID') # search by this if not versioned
|
|
|
|
|
|
|
|
# if target is versioned, want to know that info too
|
|
|
|
original: c.objectId(title: 'Target Original') # search by this if versioned
|
|
|
|
version:
|
|
|
|
properties:
|
|
|
|
major: { type: 'number', minimum: 0 }
|
|
|
|
minor: { type: 'number', minimum: 0 }
|
|
|
|
})
|
2014-06-27 15:30:31 -04:00
|
|
|
|
|
|
|
_wasPending: type: 'boolean'
|
2014-06-28 11:44:07 -04:00
|
|
|
_newlyAccepted: type: 'boolean'
|
2014-04-08 22:26:19 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
c.extendBasicProperties(PatchSchema, 'patch')
|
|
|
|
|
|
|
|
module.exports = PatchSchema
|