0

I want to make user profile like Instagram, the user can make his profile public or private in the settings, how data structure would be in this case?

AL.
  • 36,815
  • 10
  • 142
  • 281
Bensalem Ilyes
  • 29
  • 1
  • 1
  • 7

1 Answers1

1

Remember - users will have only the level of access that you define in your app.

You can have a field within the profile setting for public / private, and when you retrieve the list of profiles, filter for public only

There are many ways you could implement this, but here's an example of how you might structure your data

enter image description here

and then you just need to return all public profiles to your users

With this approach you would need to make sure you move records between private and public when you move them. Alternatively, you could have them all in one tree with an addition index on visibiity, and query based on that field

Russell
  • 5,436
  • 2
  • 19
  • 27