@@ -13,6 +13,9 @@ import {
1313import { NodeService } from './node.service' ;
1414import { CreateNodeDto } from './dtos/createNode.dto' ;
1515import { UpdateNodeDto } from './dtos/updateNode.dto' ;
16+ import { ApiOperation , ApiResponse } from '@nestjs/swagger' ;
17+ import { MessageResponseDto } from './dtos/messageResponse.dto' ;
18+ import { CoordinateResponseDto } from './dtos/coordinateResponse.dto' ;
1619
1720export enum NodeResponseMessage {
1821 NODE_CREATED = '노드와 페이지를 생성했습니다.' ,
@@ -25,6 +28,10 @@ export enum NodeResponseMessage {
2528export class NodeController {
2629 constructor ( private readonly nodeService : NodeService ) { }
2730
31+ @ApiResponse ( {
32+ type : MessageResponseDto ,
33+ } )
34+ @ApiOperation ( { summary : '노드를 생성하면서 페이지도 함께 생성합니다.' } )
2835 @Post ( '/' )
2936 @HttpCode ( HttpStatus . CREATED )
3037 async createNode ( @Body ( ) body : CreateNodeDto ) : Promise < { message : string } > {
@@ -33,7 +40,12 @@ export class NodeController {
3340 message : NodeResponseMessage . NODE_CREATED ,
3441 } ;
3542 }
36-
43+ @ApiResponse ( {
44+ type : MessageResponseDto ,
45+ } )
46+ @ApiOperation ( {
47+ summary : '노드를 삭제하면서 페이지도 삭제합니다. (delete: cascade)' ,
48+ } )
3749 @Delete ( '/:id' )
3850 @HttpCode ( HttpStatus . OK )
3951 async deleteNode ( @Param ( 'id' ) id : number ) : Promise < { message : string } > {
@@ -42,7 +54,10 @@ export class NodeController {
4254 message : NodeResponseMessage . NODE_DELETED ,
4355 } ;
4456 }
45-
57+ @ApiResponse ( {
58+ type : MessageResponseDto ,
59+ } )
60+ @ApiOperation ( { summary : '노드의 제목, 좌표를 수정합니다.' } )
4661 @Patch ( '/:id' )
4762 @HttpCode ( HttpStatus . OK )
4863 async updateNode (
@@ -54,7 +69,10 @@ export class NodeController {
5469 message : NodeResponseMessage . NODE_UPDATED ,
5570 } ;
5671 }
57-
72+ @ApiResponse ( {
73+ type : CoordinateResponseDto ,
74+ } )
75+ @ApiOperation ( { summary : '노드의 좌표를 가져옵니다.' } )
5876 @Get ( ':id/coordinates' )
5977 @HttpCode ( HttpStatus . OK )
6078 async getCoordinates ( @Param ( 'id' , ParseIntPipe ) id : number ) {
0 commit comments