Created
February 16, 2016 00:20
-
-
Save BerkeleyTrue/34834ce1169fc64d3b4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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