feat: Implement email service with welcome, password reset, and verification templates, and add application logo.

This commit is contained in:
pradeepkumar
2025-12-22 11:57:16 +05:30
parent 158a617600
commit 1ab86b488a
17 changed files with 742 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ import {
ForgotPasswordDto,
ResetPasswordDto,
RefreshTokenDto,
VerifyEmailDto,
} from './dto';
import { JwtAuthGuard } from './guards';
import { Public, CurrentUser } from './decorators';
@@ -189,6 +190,56 @@ export class AuthController {
return this.authService.resetPassword(dto);
}
// ==========================================
// VERIFY EMAIL
// ==========================================
@Public()
@Post('verify-email')
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: 'Verify email with token' })
@ApiBody({ type: VerifyEmailDto })
@ApiResponse({
status: 200,
description: 'Email verified successfully',
schema: {
example: {
success: true,
data: {
message: 'Email verified successfully',
},
},
},
})
@ApiResponse({ status: 400, description: 'Invalid or expired token' })
async verifyEmail(@Body() dto: VerifyEmailDto) {
return this.authService.verifyEmail(dto);
}
// ==========================================
// RESEND VERIFICATION EMAIL
// ==========================================
@Post('resend-verification')
@UseGuards(JwtAuthGuard)
@HttpCode(HttpStatus.OK)
@ApiBearerAuth('JWT-auth')
@ApiOperation({ summary: 'Resend email verification' })
@ApiResponse({
status: 200,
description: 'Verification email sent',
schema: {
example: {
success: true,
data: {
message: 'Verification email sent',
},
},
},
})
@ApiResponse({ status: 401, description: 'Unauthorized' })
async resendVerification(@CurrentUser('id') userId: string) {
return this.authService.resendVerificationEmail(userId);
}
// ==========================================
// REFRESH TOKEN
// ==========================================