2014-05-11 10:13:13 -04:00
|
|
|
c = require './../schemas'
|
|
|
|
|
|
|
|
module.exports =
|
2014-05-13 16:46:56 -04:00
|
|
|
AchievementSchema =
|
2014-05-11 10:13:13 -04:00
|
|
|
type: 'object'
|
|
|
|
properties:
|
|
|
|
name: c.shortString({title: 'Display Name'})
|
|
|
|
query: { $ref: 'mongoFindQuery' } # TODO make this happen
|
2014-05-13 16:46:56 -04:00
|
|
|
worth: { type: 'number' }
|
2014-05-18 07:21:27 -04:00
|
|
|
model: { type: 'string' }
|
2014-05-13 16:46:56 -04:00
|
|
|
description: { type: 'string' }
|
2014-05-18 07:21:27 -04:00
|
|
|
userField: { type: 'string' }
|
2014-05-19 19:25:41 -04:00
|
|
|
related: c.objectId
|
2014-05-11 11:16:16 -04:00
|
|
|
proportionalTo:
|
2014-05-11 10:13:13 -04:00
|
|
|
type: 'string'
|
2014-05-11 11:16:16 -04:00
|
|
|
description: 'For repeatables only. Denotes the field a repeatable achievement needs for its calculations'
|
2014-05-11 10:13:13 -04:00
|
|
|
required: ['name', 'query', 'worth', 'collection']
|
|
|
|
|
2014-05-13 16:46:56 -04:00
|
|
|
MongoFindQuerySchema =
|
|
|
|
title: 'MongoDB Query'
|
|
|
|
id: 'mongoFindQuery'
|
|
|
|
type: 'object'
|
|
|
|
patternProperties:
|
|
|
|
'^[a-zA-Z0-9_\-\$]*$':
|
|
|
|
type: [ 'string', 'object' ]
|
|
|
|
oneOf: [
|
|
|
|
{ $ref: 'mongoQueryOperator' }, # TODO make this happen
|
|
|
|
{ type: 'string' }
|
|
|
|
]
|
|
|
|
additionalProperties: false
|
2014-05-11 10:13:13 -04:00
|
|
|
|
2014-05-13 16:46:56 -04:00
|
|
|
# TODO add these: http://docs.mongodb.org/manual/reference/operator/query/
|
|
|
|
MongoQueryOperatorSchema =
|
|
|
|
title: 'MongoDB Query operator'
|
|
|
|
id: 'mongoQueryOperator'
|
|
|
|
type: 'object'
|
|
|
|
properties:
|
|
|
|
'$gt': type: 'number'
|
|
|
|
'$gte': type: 'number'
|
|
|
|
'$in': type: 'array'
|
|
|
|
'$lt': type: 'number'
|
|
|
|
'$lte': type: 'number'
|
|
|
|
'$ne': type: [ 'number', 'string' ]
|
|
|
|
'$nin': type: 'array'
|
|
|
|
additionalProperties: true # TODO set to false when the schema's done
|