Reputation: 705
What is the recommended way to store user settings in Parse Cloud?
I've two approaches of which I don't know which one is best suitable for a scalable app or if there is a better way of doing this.
The first approach is to create a class with all settings for each user and have a relation between the user and the setting.
The other approach is to simply store the settings for each user in a user object. I feel the second approach is the better one.
I've had a look at PFInstallation
but not entirely sure if that can be used to set User Settings or if the use case is for push notifications only.
Upvotes: 2
Views: 296
Reputation: 1602
Both of your solutions:
Are valid.
The advantage of #1 is that it will be easier to secure the settings. In the case of #1, you can create an ACL when you create each user's setting object that will allow only the user associated with that record to read, edit or delete the settings object.
In the case of #2, if any of the fields are sensitive, then you'll need to explicitly protect those fields using the userSensitiveFields
config key to ensure that they are not returned when user records are queried.
Upvotes: 1