Reputation: 1
i dont want to get the soft deleted items from relations when i find any object. how to do it?
const product = await this.productRepository.findOne({
where: {
id: productId,
},
relations: [
'items',
'billingAddress',
'shippingAddress',
'contact',
'tax',
'paymentTerm',
'transactions',
'salesPerson',
],
});
here i soft deleted a transaction, but when i am trying to find the product, i am getting the soft deleted transaction too, what i can do to avoid?
Upvotes: 0
Views: 207
Reputation: 1
I tried and found out this is a default behaviour. I just have to put deletedAt column in the entity with the @DeleteDateColumn attribute.
@DeleteDateColumn({ nullable: true })
deletedAt:Date
and the relation doesn't join the column having deletedAt not null.
Upvotes: 0