rocknrolla777/loopback-cascade-delete-mixin

Deep cascade deleting

Closed this issue · 6 comments

I have a Model Post that represent a forum post and it has two relation with itself named parent and children and another relation named attachment that is used to join a file to the post.

A post can be the first post of a thread, so all the other post of the thread will have it as parent and it will have them as children.

That's my config in the json file :
"mixins": { "CascadeDelete": { "relations": ["attachments", "children"] } },
The prolem is that when I delete a parent post, all the children are properly deleted along with the attachements of the parents.
But, when the children are deleted their attachments are not, so it creates orphaned attachements.
That's what I mean by 'Deep cascade deleting'.
It should in my opinion delete the attachments of the children too as the children are Post models.

Thanks for sharing your work anyway!
Have a nice day

@toniopelo Thanks for your response! I really don't have enough time. But I promise that I'll implement all issues!

I've made a pull request for this issue. #3

Could we get this merged? I am having this issue right now - on a tight deadline 😆

@devpascoe Today I'm going to check all PRs and issues

legend!

This one can be closed fixed by #3 👍