This file contains hidden or 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
/* | |
* Author: Felipe Herranz ([email protected]) | |
* Contributors:Francesco Verheye ([email protected]) | |
* Israel Dominguez ([email protected]) | |
*/ | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import android.os.Handler; |
This file contains hidden or 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
Parse.Cloud.define("testSave", function(request, response) { | |
var id = request.params.class1Id; | |
var query = new Parse.Query('Class1'); | |
query.include('Class2Pointer'); | |
query.get(id).then(function (Class1) { | |
var Class2 = Class1.get('Class2Pointer'); | |
Class2.set('text', 'snoopy'); | |
// test 1: this will have duplicate save two times | |
Class2.set('Class1Pointer', Class1); | |
// test 2: this will save once |
This file contains hidden or 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
Parse.Cloud.beforeSave("Posts", function(request, response) { | |
if (request.object.existed()) { | |
return response.success(); // the Post already exist, this must be an Update action | |
} | |
// do a query to "Posts" to check the oldest related "Posts" to current user | |
var query = new Parse.Query("Posts"); | |
query.equalTo("PostUser", Parse.User.current()); | |
query.equalTo("Topic", YOUR_REFERENCED_TOPIC_OBJECT); // assume you are want to reference it by pointer | |
query.descending("createdAt"); |
This file contains hidden or 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
Parse.Cloud.beforeSave("Requests", function(request, response) { | |
var postObj = new Parse.Object("Posts"); | |
postObj.set("objectId", request.object.get("Post_Pointer")); | |
var query = new Parse.Query("Requests"); | |
query.equalTo("Post_Pointer", postObj); | |
query.equalTo("Requester", Parse.User.current()); | |
query.first({ | |
success: function(object) { | |
if (object) { |
NewerOlder