I'm working on a NestJS project, which has two tables (one is the parent of the other). They have a one-to-many non-nullable relationship. However, the child table is soft-deletable.
After I soft delete a child row, if I query the parent table, I get a "null" value in the relation column, which is an invalid value (as it is non-nulleable). I need all my queries to exclude parent rows by default, if their related child row is soft deleted.
I also noticed that this doesn't work:
options.where = {
child: Not(IsNull()),
};
TypeORM doesn't seem to recognize soft deleted entities as null, even tho they are returned as such, which means I have to look for a null value in the DeletedAt column manually.
Is there a built-in way to exclude rows by default when their relation column is soft deleted?