Skip to content

Instantly share code, notes, and snippets.

@BerkeleyTrue
Created February 16, 2016 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BerkeleyTrue/34834ce1169fc64d3b4f to your computer and use it in GitHub Desktop.
Save BerkeleyTrue/34834ce1169fc64d3b4f to your computer and use it in GitHub Desktop.
function completedChallenge(req, res, next) {
// build user update data, no longer mutates user object
const { updateData, alreadyCompleted, points } = buildUpdateData(req);
// calls an update data using user instance id and sends only updateData
return user.update$(updateData)
.subscribe(
count => log('%s documents updated', count),
next,
function() {
return res.json({
points,
alreadyCompleted
});
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment