diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 770b5ec..8215199 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -1,6 +1,4 @@ import { Module } from '@nestjs/common'; -import { AppController } from './app.controller'; -import { AppService } from './app.service'; import { TypeOrmModule } from '@nestjs/typeorm'; import { typeORMConfig } from './configs/typeorm.config'; import { UsersModule } from './user/user.module'; diff --git a/backend/src/configs/typeorm.config.ts b/backend/src/configs/typeorm.config.ts index af9959b..78bbc9e 100644 --- a/backend/src/configs/typeorm.config.ts +++ b/backend/src/configs/typeorm.config.ts @@ -1,7 +1,9 @@ import { TypeOrmModuleOptions } from '@nestjs/typeorm'; import { config } from 'dotenv'; -if (process.env.NODE_ENV === 'dev') {config()} +if (process.env.NODE_ENV === 'dev') { + config(); +} export const typeORMConfig: TypeOrmModuleOptions = { type: 'mysql', diff --git a/backend/src/exceptions/exception.fillter.ts b/backend/src/exceptions/exception.fillter.ts index e423428..66b0888 100644 --- a/backend/src/exceptions/exception.fillter.ts +++ b/backend/src/exceptions/exception.fillter.ts @@ -14,7 +14,7 @@ export class DuplicateEmailExceptionFilter implements ExceptionFilter { message: '이메일 중복', }); return; - } + } if (exception instanceof ValidationException) { response.status(HttpStatus.INTERNAL_SERVER_ERROR).json({ statusCode: exception.getStatus(), diff --git a/backend/src/exceptions/validation.exception.ts b/backend/src/exceptions/validation.exception.ts index aeff67f..777bc50 100644 --- a/backend/src/exceptions/validation.exception.ts +++ b/backend/src/exceptions/validation.exception.ts @@ -2,10 +2,10 @@ import { BadRequestException, HttpStatus } from '@nestjs/common'; export class ValidationException extends BadRequestException { constructor(message: string) { - super({ statusCode: HttpStatus.BAD_REQUEST, message}); + super({ statusCode: HttpStatus.BAD_REQUEST, message }); } getMessage() { return this.message; } -} \ No newline at end of file +} diff --git a/backend/src/exceptions/validation.user.pipe.ts b/backend/src/exceptions/validation.user.pipe.ts index 02f2e83..a75d119 100644 --- a/backend/src/exceptions/validation.user.pipe.ts +++ b/backend/src/exceptions/validation.user.pipe.ts @@ -1,15 +1,15 @@ -import { ValidationPipe } from "@nestjs/common"; -import { ValidationException } from "./validation.exception"; +import { ValidationPipe } from '@nestjs/common'; +import { ValidationException } from './validation.exception'; -export class UserValidationPipe extends ValidationPipe { +export class UserValidationPipe extends ValidationPipe { exceptionFactory = (errors: any[]) => { - const customErrors = errors.map((error) => { - return { - property: error.property, - constraints: error.constraints, - message: 'Custom validation error message', - }; + errors.map((error) => { + return { + property: error.property, + constraints: error.constraints, + message: 'Custom validation error message', + }; }); throw new ValidationException('입력 값이 유효하지 않습니다'); }; -} \ No newline at end of file +} diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts index 039db23..074722d 100644 --- a/backend/src/user/user.controller.ts +++ b/backend/src/user/user.controller.ts @@ -1,4 +1,4 @@ -import { Body, Controller, Post, HttpStatus, UseFilters, UsePipes, ValidationPipe } from '@nestjs/common'; +import { Body, Controller, Post, HttpStatus, UseFilters, UsePipes } from '@nestjs/common'; import { UsersService } from './user.service'; import { UserDto } from './dto/user.dto'; import { DuplicateEmailExceptionFilter } from 'src/exceptions/exception.fillter'; @@ -11,7 +11,7 @@ export class UsersController { @Post('register') @UsePipes(new UserValidationPipe()) - async registerUser(@Body() userDto: UserDto): Promise<{ statusCode: number, message: string }> { + async registerUser(@Body() userDto: UserDto): Promise<{ statusCode: number; message: string }> { await this.userService.registerUser(userDto); return { statusCode: HttpStatus.OK, message: '회원가입 성공' }; }