Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save Array using cloud code and parse server #4365

Closed
FarisAlbalawi opened this issue Nov 21, 2017 · 3 comments
Closed

Save Array using cloud code and parse server #4365

FarisAlbalawi opened this issue Nov 21, 2017 · 3 comments

Comments

@FarisAlbalawi
Copy link

FarisAlbalawi commented Nov 21, 2017

I'm trying to Save array using cloud cod with parse server. I want if user1 follow user2 I want the user2 get the user1's objectId and Save it to Array table in user class

class called (_User) in user class table called (whoFollowers)

this is my cloud code

Parse.Cloud.define("whoFollowers", function(request, response) {
var newts = new Array();
var parsedJson = JSON.parse( request.params.push );
for ( var i = 0; i < parsedJson.length; i++ )
{

var userId = request.params.userId;
var User = Parse.Object.extend('_User'),
var whoFollowers = request.params.datalist[i];
User.set("push", "0");
newts[i]=User;
}

Parse.Object.saveAll(newts,{
success: function(list) {
response.success("ok " );

},
 error: function(error) {
response.error("failure on saving list ");
},
});    
});

// swift code

 let request = [
                "userId" : self.otheruserObj.objectId!,
                "whoFollowers" : currUser.objectId!,
                ] as [String : Any]

            PFCloud.callFunction(inBackground: "whoFollowers", withParameters: request as [String : Any], block: { (results, error) in
                if error == nil {
                    print ("success")

                }})
@addisonElliott
Copy link
Contributor

What is the error you are receiving?

@addisonElliott
Copy link
Contributor

@fairs-222 What is the status of this? Can you please provide some more information about what you are trying to accomplish and what errors you are receiving?

@stale
Copy link

stale bot commented Sep 18, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants