Last active
August 27, 2015 17:27
-
-
Save Hanspagh/3b5dccce63d936827605 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
function test(req, res) { | |
//get the userId and... | |
// | |
req.models.addedRealEstate.exists({userId: userId, realEstateId: realEstateId}) | |
.then(function(recordExists) { | |
//If record its exists, stop here else create record in db | |
if(personIsActive) { return res.json('Error'); } | |
}).then(function() { | |
return req.models.addedRealEstate.create({userId: userId, realEstateId: realEstateId, source: source}); | |
}).then(function(realEstate) { | |
return res.json('Success'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment