tsbonev / nharker

NHaker - an offline writing organization tool
0 stars 0 forks source link

nharker-server: handle inheritance deletion #133

Closed tsbonev closed 6 years ago

tsbonev commented 6 years ago

There are two ways to solve the deletion of objects referenced in other objects:

1) Only delete an object from its parent, this way deleting an entry happens through the article and the article can just update itself. Pros: Would be a clean-ish way to make sure that no reference is left null. Cons: Would couple the business logic of all of the domain objects and somewhat make the frontend harder to write.

2) Scan every object for a reference when handling a deleted event. Pros: Would be decoupled because of the event bus. Cons: Would take up processing time (which won't be that big of a hassle)

3) Remove deleted reference when building. Pros: Would decouple deletion from the objects entirely; Would leave the responsibility to the object builder that the frontend will be using. Cons: Would amass errors in the logs (which isn't a big deal).

tsbonev commented 6 years ago

Solutions: Catalogues will only delete themselves, retaining info about their previous relationships (see #155). Articles will delete themselves and all of their entries and property entries, keeping their references to be restored as a bunch later.