cloud-code

how to model a parse class to include isliked, isfollowing fields along with the PFQuery results

拈花ヽ惹草 提交于 2020-01-06 02:21:20
问题 I can't find an efficient way to query Posts(PFObject) or Users(PFUser) classes and also have the isPostLiked(boolean) and isUserFollowed(boolean) included in the results array respectively. Lets say, I have queried and received 25 Posts from the server. I want to fill in the like heart button with red if I have previously liked this Post. It would be very inefficient to query all the likes of these Posts and see if current user is contained in the results. Is it possible to write a cloud

beforeSave causes Queries to return nothing

廉价感情. 提交于 2020-01-04 01:56:53
问题 I have a cloud function that takes in a request and creates objects as well as associates them in a chain of promises. Without a beforeSave this function works fine but the beforeSave exists to prevent duplicate entries of email addresses in the Email Class. REQUEST { "projectDescription": "Testing saveProject", "projectTitle": "This is only a test, in the event of a real post this will have an actual description", "isEmailEnabled": true, "shareEmails": [ "test1@gmail.com", "test2@gmail.com",

Accessing original field in Parse.com Cloud Code beforeSave function

不想你离开。 提交于 2020-01-03 21:03:30
问题 The ultimate goal is to detect changes between an existing Parse object and the incoming update using the beforeSave function in Cloud Code. From the Cloud Code log available through parse.com, one can see the input to beforeSave contains a field called original and another one called update . Cloud Code log: Input: {"original": { ... }, "update":{...} I wonder if, and how, we can access the original field in order to detect changing fields before saving. Note that I've already tried several

Accessing original field in Parse.com Cloud Code beforeSave function

坚强是说给别人听的谎言 提交于 2020-01-03 21:02:29
问题 The ultimate goal is to detect changes between an existing Parse object and the incoming update using the beforeSave function in Cloud Code. From the Cloud Code log available through parse.com, one can see the input to beforeSave contains a field called original and another one called update . Cloud Code log: Input: {"original": { ... }, "update":{...} I wonder if, and how, we can access the original field in order to detect changing fields before saving. Note that I've already tried several

Parse.com: query.each executes in parrallel, reaches limit

霸气de小男生 提交于 2020-01-01 17:01:11
问题 I am running a batch job and I would like them to be run serially for each query result The problem is that it seems that query.each executes everything in parrallel How can I change my code to have everything execute serially? Parse.Cloud.job("fetchMenus", function(request, status) { var counter = 0; // Query for all users var LocationSP = Parse.Object.extend("Location"); var query = new Parse.Query(LocationSP); query.doesNotExist("menu"); query.equalTo("city_lc","new york"); // query.limit

How to create an object of specific type from JSON in Parse

回眸只為那壹抹淺笑 提交于 2019-12-31 00:45:52
问题 I have a Cloud Code script that pulls some JSON from a service. That JSON includes an array of objects. I want to save those to Parse, but using a specific Parse class. How can I do it? Here's my code. Parse.Cloud.httpRequest({ url: 'http://myservicehost.com', headers: { 'Authorization': 'XXX' }, success: function(httpResponse) { console.log("Success!"); var json = JSON.parse(httpResponse.text); var recipes = json.results; for(int i=0; i<recipes.length; i++) { var Recipe = Parse.Object.extend

How To Post A List Of Data Into Gamespark Runtime Collection ? Unity C#

落爺英雄遲暮 提交于 2019-12-25 18:40:50
问题 I got a problem how to implement gamesparks cloud code. I want to make a add posting button, the data will save to gamesparks runtime collection. So far what i have done just make a save button one data for only one for each player. But i need to make a list of player data, so one player can save multiplayer data to runtime collection. Below is my cloud code gamesparks : Spark.setScriptData("player_Data", currentPlayer); // return the player via script-data var playerDataList = Spark

parse push notification language with cloud code

帅比萌擦擦* 提交于 2019-12-25 16:44:30
问题 My app needs to be bilingual (english and italian). I'm working on push notifications through cloud code and i'm trying to send different notifications based on the client language. I created a language field in the Installation table and saved to it the [[NSLocale preferredLanguages] objectAtIndex:0]; . The code below works but i wonder if there is another way to do it. I would prefer to set the "alert" message before the query so that i would have only 1 query. Basically i need to check if

PFQueryTableViewController in Swift using Cloud Code function

可紊 提交于 2019-12-25 06:57:49
问题 I'm trying to convert a simple UITableViewController to PFQueryTableViewController in Swift. So far I know I have to initialise my class like that: (source) class TestTableViewController: PFQueryTableViewController { required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } override init(className aClassName: String!) { super.init(className: aClassName) self.parseClassName = aClassName self.textKey = "YOUR_PARSE_COLOMN_YOU_WANT_TO_SHOW" self.pullToRefreshEnabled = true self

Parse Push Notification Not Firing On Time

安稳与你 提交于 2019-12-25 04:52:11
问题 In my application the user creates an alarm which uploads an object to parse as well as schedules a push notification for the time that they select. I had it working yesterday but for some reason today, right after the user creates the alarm the notification is triggered. I can't figure it out, I don't remember changing anything. Here is my code to create the notification: PFUser *user = [PFUser currentUser]; PFObject *alarm = [PFObject objectWithClassName:@"Alarm"]; alarm[@"Active"] = @YES;