Skip to content

Commit

Permalink
fix: send email
Browse files Browse the repository at this point in the history
  • Loading branch information
wandersonDeve committed Oct 5, 2023
1 parent 4186fb7 commit 37a5523
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mails/send-mail.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ export class SendMailController {
@Post('/collaborator')
@HttpCode(200)
async sendMail(@Body() data: any) {
return await this.sendMailService.send(data, 'apoiador');
return await this.sendMailService.send(data, data.subject);
}
}
14 changes: 7 additions & 7 deletions src/modules/mails/send-mail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ export class SendMailService {
const emailToSend = NODE_ENV === 'development' ? EMAIL_TESTE : EMAIL_PROD;

await this.mailProvider.send({
context: { data },
context: data,
subject,
template: './ombudsman',
to: emailToSend,
});

if (data.subject === 'Quero ser Mentor') {
if (subject === 'Quero ser Mentor') {
await this.mailProvider.send({
context: {
CANDIDATE_FIRST_NAME: data?.name || 'Aquele que não deve ser nomeado',
JOB_NAME: data?.areas || '',
LINKEDIN_URL: data?.linkedin || '',
MESSAGE: data?.mensagem || '',
FULL_NAME: data?.data?.name || 'Aquele que não deve ser nomeado',
JOB_NAME: data?.data?.areas || '',
LINKEDIN_URL: data?.data?.linkedin || '',
MESSAGE: data?.data?.mensagem || '',
},
subject: 'Recebemos seu email',
template: './response-user',
to: data.email,
to: data.data.email,
});
}
}
Expand Down

0 comments on commit 37a5523

Please sign in to comment.