I have an Offer object that I send to the server, when this offer is about to be created I need to send a push notification to the user. Offer has a pointer to User an the field is called "to".
How can I fetch an object from a pointer?
Parse.Cloud.beforeSave("Request", function(request, response) {
var userQuery = new Parse.Query("User")
userQuery.get(request.object.get("to").id, {
success: function (user) {
console.log("user: ", user);
var installationQuery = new Parse.Query("Installation");
installationQuery.equalTo("user", user);
Parse.Push.send({
where : installationQuery,
data : {
alert : "HEllo"
},
success : function() {
},
error : function() {
console.log("error finding installation: " + error);
}
});
},
error : function (error) {
console.log("ERRRRRRRRRR");
}
});
response.success();
});