Skip to content

Instantly share code, notes, and snippets.

@AlexFrazer
Created July 8, 2015 19:56
Show Gist options
  • Save AlexFrazer/d8c7a17d2125f2f2629a to your computer and use it in GitHub Desktop.
Save AlexFrazer/d8c7a17d2125f2f2629a to your computer and use it in GitHub Desktop.
Restivus.addRoute('/order/update', {
role_required: 'admin',
auth_required: true
}, {
post: function () {
var self = this;
Orders.update(self.bodyParams.cardId, {
$set: {
"status": "completed",
"dates.received": self.bodyParams.startDate,
"dates.fulfilled": self.bodyParams.completeDate
}
}, function (err) {
self.response.write(JSON.stringify(err ? { status: 'fail', message: err.message } : { status: 'success' } ))
});
self.done();
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment