From e20fb198228bfd67f2e265002d388c833164f091 Mon Sep 17 00:00:00 2001 From: koomchang Date: Wed, 6 Nov 2024 13:57:43 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=9E=A5=EC=86=8C=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=9A=94=EC=B2=AD=20DTO=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20#52?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/{CreatePlaceDto.ts => CreatePlaceRequest.ts} | 2 +- backend/src/place/place.controller.ts | 4 ++-- backend/src/place/place.service.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) rename backend/src/place/dto/{CreatePlaceDto.ts => CreatePlaceRequest.ts} (95%) diff --git a/backend/src/place/dto/CreatePlaceDto.ts b/backend/src/place/dto/CreatePlaceRequest.ts similarity index 95% rename from backend/src/place/dto/CreatePlaceDto.ts rename to backend/src/place/dto/CreatePlaceRequest.ts index bdd85c12..51494171 100644 --- a/backend/src/place/dto/CreatePlaceDto.ts +++ b/backend/src/place/dto/CreatePlaceRequest.ts @@ -6,7 +6,7 @@ import { } from 'class-validator'; import { Place } from '../place.entity'; -export class CreatePlaceDto { +export class CreatePlaceRequest { @IsString() @IsNotEmpty() googlePlaceId: string; diff --git a/backend/src/place/place.controller.ts b/backend/src/place/place.controller.ts index af77294a..5ec6324c 100644 --- a/backend/src/place/place.controller.ts +++ b/backend/src/place/place.controller.ts @@ -1,13 +1,13 @@ import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common'; import { PlaceService } from './place.service'; -import { CreatePlaceDto } from './dto/CreatePlaceDto'; +import { CreatePlaceRequest } from './dto/CreatePlaceRequest'; @Controller('places') export class PlaceController { constructor(private readonly placeService: PlaceService) {} @Post() - async addPlace(@Body() createPlaceDto: CreatePlaceDto) { + async addPlace(@Body() createPlaceDto: CreatePlaceRequest) { return this.placeService.addPlace(createPlaceDto); } diff --git a/backend/src/place/place.service.ts b/backend/src/place/place.service.ts index ee40afc3..f269f710 100644 --- a/backend/src/place/place.service.ts +++ b/backend/src/place/place.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { PlaceRepository } from './place.repository'; -import { CreatePlaceDto } from './dto/CreatePlaceDto'; +import { CreatePlaceRequest } from './dto/CreatePlaceRequest'; import { PlaceNotFoundException } from './exception/PlaceNotFoundException'; import { PlaceAlreadyExistsException } from './exception/PlaceAlreadyExistsException'; @@ -8,13 +8,13 @@ import { PlaceAlreadyExistsException } from './exception/PlaceAlreadyExistsExcep export class PlaceService { constructor(private readonly placeRepository: PlaceRepository) {} - async addPlace(createPlaceDto: CreatePlaceDto) { - const { googlePlaceId } = createPlaceDto; + async addPlace(createPlaceRequest: CreatePlaceRequest) { + const { googlePlaceId } = createPlaceRequest; if (await this.placeRepository.findByGooglePlaceId(googlePlaceId)) { throw new PlaceAlreadyExistsException(); } - const place = createPlaceDto.toEntity(); + const place = createPlaceRequest.toEntity(); const savedPlace = await this.placeRepository.save(place); return { id: savedPlace.id }; }