diff --git a/src/app.controller.ts b/src/app.controller.ts index 76b80d6..6fa353a 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -1,16 +1,18 @@ -import { Controller, Get, Redirect } from '@nestjs/common'; +import { Controller, Get, Redirect, UseGuards } from '@nestjs/common'; import { AppService } from './app.service'; -import { PostalClientService } from 'nestjs-postal-client'; +import { LoginGuard } from './auth/guard/login.guard'; +import { MailService } from './mail/mail.service'; @Controller() export class AppController { constructor( private readonly appService: AppService, - private readonly postal: PostalClientService, + private readonly mailService: MailService, ) {} @Get() @Redirect('/auth/login') + @UseGuards(LoginGuard) getHello(): any { return; } diff --git a/src/mail/mail.service.ts b/src/mail/mail.service.ts index e9cdf88..d6e6694 100644 --- a/src/mail/mail.service.ts +++ b/src/mail/mail.service.ts @@ -110,8 +110,8 @@ export class MailService { * @returns The content of the template */ private async readHtmlTemplate(templateName: string): Promise { - return await readFile( - path.join(__dirname, '../..', 'mail/html', `${templateName}.hbs`), + return ( + await readFile(path.join(__dirname, '../..', 'mail/html', `${templateName}.hbs`)) ).toString(); } @@ -121,8 +121,8 @@ export class MailService { * @returns The content of the template */ private async readTextTemplate(templateName: string): Promise { - return await readFile( - path.join(__dirname, '../..', 'mail/text', `${templateName}.txt`), + return ( + await readFile(path.join(__dirname, '../..', 'mail/text', `${templateName}.txt`)) ).toString(); } @@ -132,7 +132,7 @@ export class MailService { * @returns The content of the template */ private async fetchTemplate(templateName: string): Promise<{ html: string; text: string }> { - // await both promises + // await both promises for html and text const [html, text] = await Promise.all([ this.readHtmlTemplate(templateName), this.readTextTemplate(templateName),