So here’s the basic design (leaving out some other unimportant fields).
It’s a pretty straightforward hierarchy: a given user can have multiple Notebook records; each Notebook can have multiple Pages; each Page can have multiple PageItems. A PageItem is linked to an Item which holds the actual content of the item; the reason for this distinction is that an Item can have multiple PageItems that point to it (i.e. you can clone an Item so that it shows up on multiple Pages).
One important criteria is that I need to be able to download/sync an entire user’s data - all of their notebooks, pages within those notebooks, etc. - when the user logs into the app. This is so a user’s whole data store can be accessed offline, be available for global searching, etc.
If this were strictly a single-user system, as I understand it I think the Realm implementation would be really easy and could even use Partition-based Sync: just have a UserID field in every table, set the Partition key to be UserID, and it’s done. I think.
However, I want a Notebook to be able to be shared among either multiple individual users (i.e. a given Notebook can be made accessible to a list of UserIDs), or if it allows for an easier Realm implementation I would be fine if the sharing were among a Group object (i.e. a given Notebook is accessible to one Group, and that Group would be composed of a list of UserIDs).
Hopefully the above explanation is clear, but of course, ask away if it’s not. The question I’m trying to answer is, can my design and sharing model be implemented via Realm (in either sync model) and if so, how?
TIA for any assistance here!!