Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions openapi.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"hash": "50b02791c7a6d303f38dd96ffece6974ae0eb8160c754e35f57027533f749d24",
"hash": "ce722f966bbb3c4eabd198291cd5cdc8eebf36391ba8eb0458d107822cfc8037",
"openapi": "3.0.0",
"paths": {
"/hello": {
Expand Down Expand Up @@ -834,7 +834,7 @@
"description": "No content."
}
},
"summary": "Send plain text email",
"summary": "Send email",
"tags": [
"email"
]
Expand Down Expand Up @@ -6356,6 +6356,9 @@
},
"content": {
"type": "string"
},
"useHtml": {
"type": "boolean"
}
},
"required": [
Expand Down
6 changes: 5 additions & 1 deletion src/email/dto/send-email.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
import { IsBoolean, IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';

export class SendEmailDto {
@IsNotEmpty()
Expand All @@ -16,4 +16,8 @@ export class SendEmailDto {
@IsNotEmpty()
@IsString()
content: string;

@IsOptional()
@IsBoolean()
useHtml?: boolean;
}
2 changes: 1 addition & 1 deletion src/email/email.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class EmailController {
) {}

/**
* Send plain text email
* Send email
*/
@ApiOperation({ operationId: 'sendEmail' })
@ApiNoContentResponse({ description: 'No content.' })
Expand Down
9 changes: 1 addition & 8 deletions src/email/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,7 @@ export class EmailService {
sendEmail(dto: SendEmailDto) {
return this.mailer.send({
...dto,
useHtml: false,
});
}

sendHtmlEmail(dto: SendEmailDto) {
return this.mailer.send({
...dto,
useHtml: true,
useHtml: !!dto.useHtml,
});
}
}
Loading