Created
March 20, 2014 06:15
-
-
Save A/9658235 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
module.exports = function () { | |
return function (req, res) { | |
var pageNum = req.params.pageNum |0; | |
var querySet = {}; | |
querySet['pages.'+pageNum] = false; | |
Project | |
.update({_id: req.params.projectID, owner: req.user._id}, {$set: querySet}) | |
.exec(function (err, updated) { | |
err | |
? res.json(500, {error: err.message}) | |
: updated | |
? Project | |
.update({_id: req.params.projectID, owner: req.user._id}, {$pull: {pages: false}}) | |
.exec(function (err) { | |
err | |
? res.json(500, {error: err.message}) | |
: res.json(200, {}); | |
}) | |
: res.json(404, {}); | |
}); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment