Closed fokion closed 4 years ago
I have a suggestion to check if the message doesn't have any association, then it should be deleted from db. While you are deleting association you can check this imho.
I will have a look. I saw that there is a field that cascades delete on the messages if a user is deleted. In my opinion, it has to be preserved as that affects the receiver. I do have to cascade the deletion if both associations are missing. I will work on it during the weekend
@marcinadd I have updated the code to remove the messages when both recipient and sender are unlinked.
For the service, it would be great to have test containers integrated first as mocking is not ideal.
For the service, it would be great to have test containers integrated first as mocking is not ideal.
Thanks for the suggestion. But I don't know is there important reason to edit all already created test classes at the moment but a contribution is welcome. If you want to help, you can create a pull request.
Create a service and a new entity that holds the relationship between the user and the message. If we delete the message we basically delete this association and not the actual message.