I hereby claim:
- I am hanspagh on github.
- I am hanspagh (https://keybase.io/hanspagh) on keybase.
- I have a public key ASA3h6WOoE-95WTIB3nG6raEf8YLQmYwl24WpF74QTVcDwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| function parseError(response) { | |
| return Promise.try(function() { | |
| if(!response || !response.body) { | |
| return new Error('Request failed'); | |
| } | |
| if(response.body.homes.length > 1) { | |
| return new Error('Too many real estates found'); | |
| } | |
| }); | |
| } |
| function findOrCreate() { | |
| db.find(id) | |
| .then(function(r){ | |
| if(!r) { | |
| db.create(id) | |
| .then(r) { | |
| return "success" | |
| } | |
| } else { | |
| return "error" |
| 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) { |