Groups assign tasks (#7887)

* Added initial code for creating and reading group tasks

* Separated group task routes. Separated shared task functions

* Added taskOrder to group

* Minor style fixes

* Fixed lint issues

* Added unit tests for task manager

* Updated task helper functions

* Fixed history test

* Fixed group task query

* Removed extra var

* Updated with new file structure

* Updated noset values

* Removed unecessary undefineds, fixed comments, Added apiignore

* Separated group task routes. Separated shared task functions

* Added unit tests for task manager

* Added initial groups assign route and tests

* Added sync assigned task to user

* Added unassign route and unlink method

* Added remove and unlink group task

* Updated linking and unlinking. Add test for updating task info

* Added delete group task and tests

* Added sync on task update and tests

* Added multiple users assignment

* Updated unassign for multiple users

* Added test for delete task with multiple assigend users

* Added update task for multiple assigned users

* Fixed issue with get tasks

* Abstracted syncable attributes and add tests

* Fixed merge conflicts

* Fixed style issues, limited group query fields, and added await

* Fixed group fields needed. Removed api v2 code

* Fixed style issues

* Moved group field under group sub document. Updated tests. Fixed other broken tests

* Renamed linkedTaskId and fixed broken alias tests

* Added debug middleware to new routes

* Fixed debug middleware import

* Added additional user id check for original group tasks

* Updated challenge task check to look for challenge id

* Added checklist sync fix
This commit is contained in:
Keith Holliday
2016-09-03 03:54:55 -05:00
committed by Matteo Pagliazzi
parent 173b3f3f84
commit 836cee2531
17 changed files with 1488 additions and 162 deletions

View File

@@ -64,6 +64,13 @@ export let TaskSchema = new Schema({
winner: String, // user.profile.name of the winner
},
group: {
id: {type: String, ref: 'Group', validate: [validator.isUUID, 'Invalid uuid.']},
broken: {type: String, enum: ['GROUP_DELETED', 'TASK_DELETED', 'UNSUBSCRIBED']},
assignedUsers: [{type: String, ref: 'User', validate: [validator.isUUID, 'Invalid uuid.']}],
taskId: {type: String, ref: 'Task', validate: [validator.isUUID, 'Invalid uuid.']},
},
reminders: [{
_id: false,
id: {type: String, validate: [validator.isUUID, 'Invalid uuid.'], default: shared.uuid, required: true},
@@ -76,7 +83,7 @@ export let TaskSchema = new Schema({
}, discriminatorOptions));
TaskSchema.plugin(baseModel, {
noSet: ['challenge', 'userId', 'completed', 'history', 'dateCompleted', '_legacyId'],
noSet: ['challenge', 'userId', 'completed', 'history', 'dateCompleted', '_legacyId', 'group'],
sanitizeTransform (taskObj) {
if (taskObj.type && taskObj.type !== 'reward') { // value should be settable directly only for rewards
delete taskObj.value;