WikiNarau / wikinarau

A new Wiki for building collaborative educational material
https://wikinarau.org
European Union Public License 1.2
1 stars 0 forks source link

Separate User Data from Content #4

Open Melchizedek6809 opened 3 months ago

Melchizedek6809 commented 3 months ago

This should probably boil down to a simple KV store, this store should keep different content types completely separate and not allow looking at arbitrary user data. Although there should be a separate global KV store.

Melchizedek6809 commented 3 months ago

There should be a 2-level KV-Store per user, first only implemented in localStorage. The first key would be the Content/Entry ID ("" for global data), and the second level key would be an ID for the specific ContentType. That way ContentType ID's only need to be unique within a given Entry, these should probably be generated in the FE Editor on element creation, since that way the ID stays the same even if we reorder the element or change the title.

With this design it should also be simple to synchronize BE/FE since a client can just subscribe to a given Entry as well as the global values. In a collaborative session each client should share their own local State with every other group member, however each User is responsible for their own Data and other users can only read, not write.

Melchizedek6809 commented 3 months ago

On second thought, there should be some invalid characters that never appear in proper Entry ID's that we can use as a prefix for global state, that way we can cleanly separate functions from each other and also allow for efficient iteration through all items for a given function.