So I am working on a community application (similar to this forum itself) which will have subscription/follower functionality. I need help to validate what I am planning is the optimum approach or is there a better way to do it. Please read and suggest.
What can be subscribed:
Communities
Users
Posts
How can it be subscribed:
Community - Join button on the community
Users - Follow button on the users
Posts - Subscribe button on post OR Reply on post
How will it get updated:
Community - Create doc on subscription collection (user: RefUser, subscription: RefCommunity)
Thats probably how I would do it too. Are you going to make a subscription with fauna too? So that the UI updates automatically when a subscription gets updated? I wonder how that would work on a larger community. When you are done can you show us the implementation you did? Thank you!
This approach really highlights how powerful a flexible schema can be! This is a good use of storing different kinds of documents or references in a single Collection.
I suspect there are several ways to map the subscriptions into Posts, and the most optimal way will probably depend on your mix of data.
One tip I can share that you might find helpful: You can retrieve the Collection Ref or just the Collection’s name from a Ref. This might help you add some logic to do different things depending on what type the subscription ref is.