From 2f5090df8f844a739c0f4e54b953cbb842ecfe3a Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Sun, 11 May 2014 17:16:16 +0200 Subject: [PATCH] Added schema objectIds and bettered the repeatable achievements --- app/schemas/models/achievement.coffee | 32 +++++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/app/schemas/models/achievement.coffee b/app/schemas/models/achievement.coffee index 70734c8a7..fbcef9c25 100644 --- a/app/schemas/models/achievement.coffee +++ b/app/schemas/models/achievement.coffee @@ -10,23 +10,41 @@ module.exports = type: 'number' collection: type: 'string' - measurableField: + proportionalTo: type: 'string' - description: 'This field denotes the field a repeatable achievement needs for its calculations' + description: 'For repeatables only. Denotes the field a repeatable achievement needs for its calculations' + ratio: + type: 'integer' + description: 'For repeatables only. Denotes how many proportionalTo\'s trigger an achievement. Usually 1.' + minimum: 1 required: ['name', 'query', 'worth', 'collection'] EarnedAchievementSchema : type: 'object' properties: - # TODO ref to user - # TODO ref to original achievement - achieved: + user: c.objectId + links: + [ + { + rel: 'extra' + href: "/db/user/{($)}" + } + ] + achievement: c.objectId + links: + [ + { + rel: 'extra' + href: '/db/user/{($)}' + } + ] + achievedAmount: type: 'number' MongoFindQuerySchema : title: 'MongoDB Query' id: 'mongoFindQuery' - type: object + type: 'object' patternProperties: '^[a-zA-Z0-9_\-\$]*$': type: [ 'string', 'object' ] @@ -40,7 +58,7 @@ module.exports = MongoQueryOperatorSchema : title: 'MongoDB Query operator' id: 'mongoQueryOperator' - type: object + type: 'object' properties: '$gt': type: 'number' '$gte': type: 'number'