diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index b0fa6095..09d689e7 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -285,6 +285,11 @@ export class AuthController { throw new NotFoundException(); } + await this.authService.sendRefererCandidateHasVerifiedAccountMail( + updatedUser.referer, + updatedUser + ); + return updatedUser.email; } } diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 4b9a0508..5f12e6dd 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -137,6 +137,16 @@ export class AuthService { return this.mailsService.sendVerificationMail(user, token); } + async sendRefererCandidateHasVerifiedAccountMail( + referer: User, + candidate: User + ) { + return this.mailsService.sendRefererCandidateHasVerifiedAccountMail( + referer, + candidate + ); + } + async generateVerificationToken(user: User) { return this.jwtService.sign( { sub: user.id }, diff --git a/src/external-services/mailjet/mailjet.types.ts b/src/external-services/mailjet/mailjet.types.ts index ba919039..6e3a3453 100644 --- a/src/external-services/mailjet/mailjet.types.ts +++ b/src/external-services/mailjet/mailjet.types.ts @@ -96,6 +96,7 @@ export const MailjetTemplates = { ONBOARDING_J1_BAO: 6129684, ONBOARDING_J3_PROFILE_COMPLETION: 6129711, REFERER_ONBOARDING_CONFIRMATION: 6324339, + REFERER_CANDIDATE_HAS_FINALIZED_ACCOUNT: 6482813, REFERED_CANDIDATE_FINALIZE_ACCOUNT: 6324039, ADMIN_NEW_REFERER_NOTIFICATION: 6328158, } as const; diff --git a/src/mails/mails.service.ts b/src/mails/mails.service.ts index fb8c21b8..01e12329 100644 --- a/src/mails/mails.service.ts +++ b/src/mails/mails.service.ts @@ -865,6 +865,22 @@ export class MailsService { }); } + async sendRefererCandidateHasVerifiedAccountMail( + referer: User, + candidate: User + ) { + await this.queuesService.addToWorkQueue(Jobs.SEND_MAIL, { + toEmail: referer.email, + templateId: MailjetTemplates.REFERER_CANDIDATE_HAS_FINALIZED_ACCOUNT, + variables: { + candidateFirstName: candidate.firstName, + candidateLastName: candidate.lastName, + refererFirstName: referer.firstName, + zone: candidate.zone, + }, + }); + } + async sendAdminNewRefererNotificationMail(referer: User) { const adminFromZone = getAdminMailsFromZone(referer.zone); await this.queuesService.addToWorkQueue(Jobs.SEND_MAIL, {