Lets say I am editing a entity e.g. Car. For that I have a page (Angular 6). That page also handles all sub sub-collections and dependencies on other objects. E.g. Collecton Parts are added and removed and even created if not available. But all that magic is done via single API (.Net 4.6) route e.g. Update/Create. all the sub collections are handled too.
Now a Car can reference another car as a base which also should include option to create a base car if not available. From here on a need for "dialog mode" was required (popup). This was achieved wrapping the same page components inside mat-dialogs etc.. Difference is that dialog mode emits the object instead of triggering service method for updating/creating.
Still all works well but from now on complexity increases...
Now someone needs to review cars, parts, ... using different criteria, giving rating, applying fixes and stuff. So a review is connected to cars and parts as review scope. In one review process all items in scope are reviewed for every criterion and every item review suggests fixes etc....
The requirement is to enable users to edit/create scope items via dialogs again (car, part, manufacturers, etc). This is where it becomes tricky. Dialog mode returns object that needs to be created/updated on a parent object.
But I don't want a review to handle again all of the above (possible but dramatically increases complexity every time a new level of children handling is added).
What is the best practice on frontend and backend to handle such complex structure? (If anyone got what Im trying to explain).
I mean if I let the e.g. ReviewService's "Update" method handle all scope child objects again like in car It just feels wrong. SRP seems to be majorly violated here and I fail to see the point. Its hard to maintain such code and just doesn't feel right.
What is the best practice handling these kind of things?
Aucun commentaire:
Enregistrer un commentaire