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) { | |
const { user, body } = req; | |
// mutates user object | |
const { alreadyCompleted } = updateUserProgress(user, body); | |
/ sends entire user object to database | |
return saveUser(req.user) | |
.subscribe( | |
() => {}, | |
next, | |
function() { | |
return res.json({ | |
points: user.progressTimestamps.length, | |
alreadyCompleted | |
}); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment