Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created January 22, 2016 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwhinnery/c8da8a3fa3787ce54852 to your computer and use it in GitHub Desktop.
Save kwhinnery/c8da8a3fa3787ce54852 to your computer and use it in GitHub Desktop.
Property.findOne({
_id: propertyId
}).then(function (property) {
var reservation = new Reservation({
message: req.body.message,
property: propertyId,
guest: user.id
});
return reservation.save();
}).then(function () {
notifier.sendNotification();
res.redirect('/properties');
}).catch(function(err) {
console.log(err);
});
Property.findOne({ _id: propertyId })
.then(function (property) {
var reservation = new Reservation({
message: req.body.message,
property: propertyId,
guest: user.id
});
return reservation.save();
})
.then(function () {
notifier.sendNotification();
res.redirect('/properties');
})
.catch(function(err) {
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment