Hello,
Im currently trying to understand Couchbase and thinking about how to implement the following use case the best way with Couchbase sync gateway.
Use Case:
- App has users, which can login with different options (apple, google, …) - oauth
- User A can create a list and share an invitation link to some other person on external services (Whatsapp, SMS or whatever)
- User B can click on the Link to accept the invitation and the user has now access to the list
- Only the the two users (User A + User B) can access (read, write, create, delete) the list, other people have no read and write access
- After User B has accepted the invitation, the link is invalid and no other users can join the list
So my idea:
- Custom collection “List”, which holds a “List” and a “ListEntry”. Both collections/schemas need to be in this single collection, because as I understand the channels are handled collection wise. So if I have two different collections, the List and a ListEntry is not in the same channel.
- Then User A creates a List object and puts it in public channel, where everyone has access to it
- User A creates a share link from it (https://somelink.app/XX/UUID)
- User B uses the REST API from the Couchbase Server to modify this List object based on the ID extracted from the URL (attention: not the sync gateway - because he cannot take care of this? - also don’t want to sync the public channel to the devices, because it may be overkill, depending on the count of objects in there)
- User B puts the list object from the public channel to an own channel (channel name == uuid of list object)
- User B puts both (himself + User A) into the channel
- Now both users are able to add entries in this channel and they are synchronized to both devices
For me the solution sounds a little bit hacky. But I don’t see something else. Do I miss something? Any input is appreciated.
Thanks!