Skip to content

Commit

Permalink
✨ Swagger 추가
Browse files Browse the repository at this point in the history
실시간 위치 기록 api에 swagger추가
  • Loading branch information
twoo1999 committed Nov 23, 2023
1 parent 0375664 commit 19e42df
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
3 changes: 3 additions & 0 deletions BE/musicspot/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { MongooseModule } from '@nestjs/mongoose';
import { JourneyModule } from './journey/journey.module';
import { SpotModule } from './spot/spot.module';
import { UserModule } from './user/user.module';
import * as dotenv from 'dotenv';
dotenv.config();

@Module({
imports: [
MongooseModule.forRoot(
Expand Down
11 changes: 11 additions & 0 deletions BE/musicspot/src/journey/dto/journeyRecord.dto.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ApiProperty } from '@nestjs/swagger';
import {
ArrayMaxSize,
ArrayMinSize,
Expand All @@ -7,9 +8,19 @@ import {
} from 'class-validator';

export class RecordJourneyDTO {
@ApiProperty({
example: '655efda2fdc81cae36d20650',
description: '여정 id',
required: true,
})
@IsString()
readonly journeyId: string;

@ApiProperty({
example: [37.555946, 126.972384],
description: '위치 좌표',
required: true,
})
@IsArray()
@ArrayMaxSize(2, { message: 'coordinate has only 2' })
@ArrayMinSize(2, { message: 'coordinate has only 2' })
Expand Down
8 changes: 8 additions & 0 deletions BE/musicspot/src/journey/journey.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ export class JourneyController {
return await this.journeyService.end(endJourneyDTO);
}

@ApiOperation({
summary: '여정 좌표 기록API',
description: '여정의 좌표를 기록합니다.',
})
@ApiCreatedResponse({
description: '생성된 여정 데이터를 반환',
type: Journey,
})
@Post('record')
async record(@Body() recordJourneyDTO: RecordJourneyDTO) {
return await this.journeyService.pushCoordianteToJourney(recordJourneyDTO);
Expand Down
2 changes: 1 addition & 1 deletion BE/musicspot/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ValidationPipe } from '@nestjs/common';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const config = new DocumentBuilder()
.setTitle('Cats example') // 문서의 제목
.setTitle('Music Spot') // 문서의 제목
.setDescription('iOS01 Music Spot App API') // 문서의 간단한 설명
.setVersion('1.0') // API의 버전(업데이트 버전)
.addTag('Music Spot')
Expand Down

0 comments on commit 19e42df

Please sign in to comment.