I am designing a mobile app for task management (to-do list plus lots of extra goodies) that can be used offline and sync up when reconnected. I have been impressed with Couch and Pouch DB but am still not sure on the best structure of databases and roles. My situation is that a user can have many tasks and tasks can be shared to many other users (read only) either directly or via assigning a task to a group and then sharing that group with specific users.
After reading through the following question: CouchDB replication strategy with dynamic groups of users I think I may not allow direct sharing of a task and and only allow sharing through Groups. Then each group is effectively a role in Couch which I can then manage authorization to. I can write an API from my web-app so that a mobile user can get a list of groups that are shared to them and then set up a one-way replication from each DB based group to their local Pouch DB. Each user would also have a read and write access to a DB of their own tasks with two way sync from Pouch to Couch. There would be a filtered replication from their own Couch DB to each Role based DB that the task belongs to.
My main questions are:
- Is this a valid structure or are there flaws in my logic that would make this difficult?
- What would be the best way to handle when a user was removed from a group/role and how to delete any previously replicated tasks on their local Pouch DB now that the Group is no longer shared to them (they no longer have that role)?
- A user may delete a group which will mean the entire role based DB will need to be deleted - are the any implications of this?