feat: Implement email service with welcome, password reset, and verification templates, and add application logo.
This commit is contained in:
17
src/main.ts
17
src/main.ts
@@ -1,5 +1,5 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ValidationPipe, Logger } from '@nestjs/common';
|
||||
import { ValidationPipe, Logger, BadRequestException } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
||||
import helmet from 'helmet';
|
||||
@@ -41,6 +41,21 @@ async function bootstrap() {
|
||||
transformOptions: {
|
||||
enableImplicitConversion: true,
|
||||
},
|
||||
exceptionFactory: (errors) => {
|
||||
const messages = errors.map((error) => {
|
||||
const constraints = error.constraints
|
||||
? Object.values(error.constraints)
|
||||
: [`${error.property} is invalid`];
|
||||
return {
|
||||
field: error.property,
|
||||
errors: constraints,
|
||||
};
|
||||
});
|
||||
return new BadRequestException({
|
||||
message: 'Validation failed',
|
||||
errors: messages,
|
||||
});
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user