update: add target service to the announement get by id for admin
This commit is contained in:
@@ -14,6 +14,7 @@ import { ReferralRewardsRepository } from "../repositories/referral-rewards.repo
|
||||
import { ReferralsRepository } from "../repositories/referrals.repository";
|
||||
@Injectable()
|
||||
export class ReferralsService {
|
||||
private MAX_ATTEMPTS = 10;
|
||||
constructor(
|
||||
private readonly referralsRepository: ReferralsRepository,
|
||||
private readonly referralCodesRepository: ReferralCodesRepository,
|
||||
@@ -25,13 +26,12 @@ export class ReferralsService {
|
||||
|
||||
if (existReferralCode) throw new BadRequestException(ReferralMessage.CODE_EXIST_FOR_USER);
|
||||
|
||||
const MAX_ATTEMPTS = 10;
|
||||
let attempts = 0;
|
||||
let code: string;
|
||||
let existCode;
|
||||
|
||||
do {
|
||||
if (attempts >= MAX_ATTEMPTS) {
|
||||
if (attempts >= this.MAX_ATTEMPTS) {
|
||||
throw new BadRequestException(ReferralMessage.CODE_GENERATION_FAILED);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user