tsbonev / nharker

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

catalogues: refactor inheritance tree #128

Closed tsbonev closed 6 years ago

tsbonev commented 6 years ago

The catalogue inheritance tree is a mess, having each catalogue have knowledge of its parent and children is not necessary, finds some way to make catalouges a simpler object.

1) Implement a nested int type inheritance. Pros: would make inheritance handling easier Cons: would still cause problems when restoring.

2) Remove the parentId from a catalogue, query for catalogue by name and then build a tree based upon that. Pros: would make inheritance somewhat easier to manage. Cons: would lose the info about the parent.

tsbonev commented 6 years ago

On referenced articles: The deletion of a catalogue does not constitute the deletion of an article, thus the restoration of a missing article reference during a restoration of a catalogue will not include the cause of deletion for that article thus making it unnecessary.

tl;dr Ignore and remove missing article references when restoring

tsbonev commented 6 years ago

Catalogue keep a collection of their children and a reference to their parent but lose their connection to articles, this way we can query for catalogues with parent of null and get the root of the inheritance tree.