diff --git a/apps/api/src/affiliate/affiliate.controller.ts b/apps/api/src/affiliate/affiliate.controller.ts index c566cc113..cec437a6c 100644 --- a/apps/api/src/affiliate/affiliate.controller.ts +++ b/apps/api/src/affiliate/affiliate.controller.ts @@ -56,16 +56,14 @@ export class AffiliateController { throw new ConflictException('Status is the same') } - if ( - (affiliate.status === 'pending' || affiliate.status === 'cancelled') && - newStatus === 'active' - ) { + if (affiliate.status !== 'active' && newStatus === 'active') { affiliateCode = affiliateCodeGenerator(affiliate.id) } if (affiliate.status === 'active' && newStatus !== 'active') { affiliateCode = null } + return await this.affiliateService.updateStatus(affiliateId, newStatus, affiliateCode) }