format + lint

This commit is contained in:
2025-06-14 14:12:18 +08:00
parent 95e8f8c648
commit 1de3a3f197
69 changed files with 1756 additions and 1583 deletions

View File

@@ -5,22 +5,26 @@ import { ResponseInterceptor } from './common/interceptors/response.interceptor'
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(new ValidationPipe({
transform: true,
whitelist: true,
forbidNonWhitelisted: true,
stopAtFirstError: true,
exceptionFactory: (errors) => {
const error = errors[0];
const firstConstraint = error.constraints ? Object.values(error.constraints)[0] : '验证失败';
app.useGlobalPipes(
new ValidationPipe({
transform: true,
whitelist: true,
forbidNonWhitelisted: true,
stopAtFirstError: true,
exceptionFactory: (errors) => {
const error = errors[0];
const firstConstraint = error.constraints
? Object.values(error.constraints)[0]
: '验证失败';
throw new BadRequestException({
message: firstConstraint,
error: 'Bad Request',
statusCode: 400
});
}
}));
throw new BadRequestException({
message: firstConstraint,
error: 'Bad Request',
statusCode: 400,
});
},
}),
);
app.useGlobalInterceptors(new ResponseInterceptor());
await app.listen(process.env.PORT ?? 3001);
}