-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
schema to delete a user. #4685
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
Comments
Based on your scenario, yes, you need to do this, but this operation dont need to happen in the same time of user delete his account. You can do this in background gradually. The answear is based in your scenario. :) |
Instead of storing the number, you could calculate it if you had a Follower join table. Then you could just do a query.count() with constraints for the current user following / being followed to get the counts. You'd also be able to use that as a matchesQuery constraint to get feeds and what not. |
@JacobJT I have in the user class, a relation with all the users that follow it, I must make a query.count (); in relation if so. The parse will not have to count all objects 1 by 1? |
@joaoarmandoo I haven't worked a ton with relations so I'm not sure how their counts work. Join tables are a fairly common solution for this, though. A Following class, with Follower user pointer and Following user pointer, and you could do That being said, you could also update the beforeDelete handler for users to call another function that takes the user's followers / following relations and removes them from each user. You wouldn't be able to have it be a success condition, though, as it would take too long and the destroy would time out. The Join Table is how I would implement this, if you were starting from scratch or are still in a dev phase where you could swap out the implementation, but without knowing how extensively that relation is built into your code base or the full potential of relations, I can't say with certainty that it's the best solution for you. |
I'm facing some difficulties with updating counters.
I'm developing a "social networking" application, this is my first application.
In the scenario, we have the following situation:
User X has 300 followers.
User Y will in turn follow user X, then I will go to the Follows counter of user X and increase by 1, user X happens to have 301 followers now, and I also go to user Y who has followed up, and increased your following counter at 1.
The problem lies in, if user X, resolves to delete your account, I will have to make 301 calls, for each of the followers of user X, and decrease the following counter of all those users at -1, That is the way correct to do this?
-Sorry my english, i'm using translator
The text was updated successfully, but these errors were encountered: