Created
June 18, 2015 16:37
-
-
Save ashleygwilliams/3eab77527f3daf423b4c 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
43 BaseController.prototype.update = function(req, reply) { | |
44 var result = this.Model.query({ | |
45 where: { | |
46 id: req.params.id | |
47 } | |
48 }) | |
49 .save(this.data(req), { | |
50 method: 'update', | |
51 patch: 'true', | |
52 require: 'true' | |
53 }) | |
54 .call('fetch') | |
55 .then(function(record) { | |
56 if (!record) { throw Boom.notFound(); } | |
57 return req.generateResponse(record.toJSON()) | |
58 .code(201); | |
59 }) | |
60 .catch(function(e){ | |
61 return Boom.create(500, 'No Rows Updated'); | |
62 }) | |
63 return reply(result); | |
64 }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment