These are very simplistic, just to show the concept. You would probably want to have some Cloud Code that will verify things in a before-save function. Also all my examples haven't included any error handling but you should add some.
Approve a request
// assuming you saved the FriendRequest.id as maybe an attribute // data-friend-request-id="xxxx" on the Approve button this code is // linked to var friendRequest = new FriendRequest(); friendRequest.id = $(this).data('friendRequestId'); friendRequest.set('status', RequestStatus.approved); friendRequest.save();
Reject a request
As per Approve, but usefriendRequest.set('status', RequestStatus.rejected);
Un-friend
As per Approve, but usefriendRequest.set('status', RequestStatus.rejected);
1 comment:
Hello Timothy. I came across your profile on stackoverflow.com and this blog post while searching for some insight into our scaling issues. I am one of the founders of an app built on top of Parse. We are experiencing extremely fast growth: over 40k user with actions exceeding 17 million. I'm sure we would benefit greatly from some advice on our architecture. Please let me know if you might have some time for a quick call to see if you might be able to help. It would be much appreciated!
Post a Comment