Skip to content

Commit

Permalink
Merge pull request #364 from boostcampwm2023/BE/story/api-versioning_…
Browse files Browse the repository at this point in the history
…setting

[BE] ✨ : versioning  적용
  • Loading branch information
twoo1999 authored Feb 8, 2024
2 parents f02f858 + 2eb5459 commit 6420b3e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
18 changes: 12 additions & 6 deletions BE/musicspot/src/journey/controller/journey.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Query,
Param,
Delete,
Version,
} from '@nestjs/common';
import { JourneyService } from '../service/journey.service';
import { StartJourneyReqDTO } from '../dto/journeyStart/journeyStart.dto';
Expand Down Expand Up @@ -36,7 +37,6 @@ import { DeleteJourneyReqDTO } from '../dto/journeyDelete.dto';
import { Journey } from '../entities/journey.entity';
import { LastJourneyResDTO } from '../dto/journeyLast.dto';


@Controller('journey')
@ApiTags('journey 관련 API')
export class JourneyController {
Expand All @@ -54,7 +54,14 @@ export class JourneyController {
async create(@Body() startJourneyDTO: StartJourneyReqDTO) {
return await this.journeyService.insertJourneyData(startJourneyDTO);
}

@ApiOperation({
summary: '여정 시작 API',
description: '여정 기록을 시작합니다.',
})
@ApiCreatedResponse({
description: '생성된 여정 데이터를 반환',
type: StartJourneyResDTO,
})
@ApiOperation({
summary: '여정 종료 API',
description: '여정을 종료합니다.',
Expand Down Expand Up @@ -83,7 +90,6 @@ export class JourneyController {
return returnData;
}


@ApiOperation({
summary: '여정 조회 API',
description: '해당 범위 내의 여정들을 반환합니다.',
Expand Down Expand Up @@ -127,7 +133,9 @@ export class JourneyController {
minCoordinate,
maxCoordinate,
};
return await this.journeyService.getJourneyByCoordinationRange(checkJourneyDTO);
return await this.journeyService.getJourneyByCoordinationRange(
checkJourneyDTO,
);
}

@ApiOperation({
Expand All @@ -141,7 +149,6 @@ export class JourneyController {
@Get('last')
async loadLastData(@Body('userId') userId) {
return await this.journeyService.getLastJourneyByUserId(userId);

}

@ApiOperation({
Expand Down Expand Up @@ -170,4 +177,3 @@ export class JourneyController {
return await this.journeyService.deleteJourneyById(deleteJourneyDto);
}
}

12 changes: 7 additions & 5 deletions BE/musicspot/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';
import { ValidationPipe } from '@nestjs/common';
import { ValidationPipe, VersioningType } from '@nestjs/common';
import { NestExpressApplication } from '@nestjs/platform-express';
import { AllExceptionFilter } from './filters/exception.filter';
import { winstonLogger } from './common/logger/winston.util';

async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule);

app.enableVersioning({
type: VersioningType.URI,
});
const config = new DocumentBuilder()
.setTitle('Music Spot') // 문서의 제목
.setDescription('iOS01 Music Spot App API') // 문서의 간단한 설명
.setVersion('1.0') // API의 버전(업데이트 버전)
.setVersion('2.0') // API의 버전(업데이트 버전)
.addTag('Music Spot')
.build();
const document = SwaggerModule.createDocument(app, config);
Expand Down

0 comments on commit 6420b3e

Please sign in to comment.