From 104e48900094ebb448ded5606ff54438dd65018d Mon Sep 17 00:00:00 2001 From: Sergey Kondrikov Date: Thu, 8 Jun 2023 18:45:06 +0300 Subject: [PATCH] fix(server): Filter out deleted partners (#2697) * Filter out deleted partners * Add separate filter clause for soft deleted users --------- Co-authored-by: Alex Tran --- server/src/domain/partner/partner.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/domain/partner/partner.service.ts b/server/src/domain/partner/partner.service.ts index 6486df7426..d870dc115f 100644 --- a/server/src/domain/partner/partner.service.ts +++ b/server/src/domain/partner/partner.service.ts @@ -32,7 +32,10 @@ export class PartnerService { async getAll(authUser: AuthUserDto, direction: PartnerDirection): Promise { const partners = await this.repository.getAll(authUser.id); const key = direction === PartnerDirection.SharedBy ? 'sharedById' : 'sharedWithId'; - return partners.filter((partner) => partner[key] === authUser.id).map((partner) => this.map(partner, direction)); + return partners + .filter((partner) => partner.sharedBy && partner.sharedWith) // Filter out soft deleted users + .filter((partner) => partner[key] === authUser.id) + .map((partner) => this.map(partner, direction)); } private map(partner: PartnerEntity, direction: PartnerDirection): UserResponseDto {