Aded challenge migration sync (#8492)

* Aded challenge migration sync

* Fixed async grouping

* Mapped promises and added error catching

* Added placholders for syncing specific challenges

* Prvented overriding of attribute and createdAt
This commit is contained in:
Keith Holliday
2017-03-17 15:58:55 -06:00
committed by Sabe Jones
parent db9befde17
commit 21ad808cc1
4 changed files with 107 additions and 25 deletions

View File

@@ -184,7 +184,7 @@ export async function getTasks (req, res, options = {}) {
export function syncableAttrs (task) {
let t = task.toObject(); // lodash doesn't seem to like _.omit on Document
// only sync/compare important attrs
let omitAttrs = ['_id', 'userId', 'challenge', 'history', 'tags', 'completed', 'streak', 'notes', 'updatedAt', 'group', 'checklist'];
let omitAttrs = ['_id', 'userId', 'challenge', 'history', 'tags', 'completed', 'streak', 'notes', 'updatedAt', 'createdAt', 'group', 'checklist', 'attribute'];
if (t.type !== 'reward') omitAttrs.push('value');
return _.omit(t, omitAttrs);
}