Created
May 28, 2014 21:47
-
-
Save Kuirak/fd5a3550dd83c7e451bf 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
Event.findOne({type:event.type,session_id:event.session_id,timestamp:event.timestamp}).then(function(data){ | |
if(data){ | |
data.params =event.params; | |
return Q.ninvoke(data,'save') | |
}else{ | |
return Event.create(event).then(Event.publishCreate); | |
} | |
}).fail(sails.log.error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment