So we're trying to check our codes for possible bugs when a resource related to another is deleted. For example, we have a Progress entity which is related to User, which is then related to Employee. The User entity implements a soft-delete. If we delete a user related to a progress data, then this.logger.log(progress.user.employee) would return an error. Of course, making user optional (progress.user?) would solve it, but I was curious if making the User column optional in the Progress entity would make any difference at all.
So on the Progress entity, we have this:
@ManyToOne((_) => User)
@JoinColumn({ name: 'user_id' })
user: User;
I want to know if making this user optional would change anything.