Added support for grouping tasks by chllenge

This commit is contained in:
Keith Holliday
2017-02-02 13:19:30 -07:00
committed by Alys
parent aef71db0f5
commit c244fe488d
8 changed files with 29 additions and 6 deletions

View File

@@ -58,6 +58,7 @@ export let TaskSchema = new Schema({
userId: {type: String, ref: 'User', validate: [validator.isUUID, 'Invalid uuid.']}, // When not set it belongs to a challenge
challenge: {
name: {type: String, default: 'No Category'},
id: {type: String, ref: 'Challenge', validate: [validator.isUUID, 'Invalid uuid.']}, // When set (and userId not set) it's the original task
taskId: {type: String, ref: 'Task', validate: [validator.isUUID, 'Invalid uuid.']}, // When not set but challenge.id defined it's the original task
broken: {type: String, enum: ['CHALLENGE_DELETED', 'TASK_DELETED', 'UNSUBSCRIBED', 'CHALLENGE_CLOSED', 'CHALLENGE_TASK_NOT_FOUND']}, // CHALLENGE_TASK_NOT_FOUND comes from v3 migration