88 Body ,
99 HttpCode ,
1010 HttpStatus ,
11+ ParseIntPipe ,
1112} from '@nestjs/common' ;
1213import { PageService } from './page.service' ;
1314import { CreatePageDto } from './dtos/createPage.dto' ;
@@ -28,6 +29,7 @@ export enum PageResponseMessage {
2829@Controller ( 'page' )
2930export class PageController {
3031 constructor ( private readonly pageService : PageService ) { }
32+
3133 @ApiResponse ( {
3234 type : MessageResponseDto ,
3335 } )
@@ -53,7 +55,9 @@ export class PageController {
5355 } )
5456 @Delete ( '/:id' )
5557 @HttpCode ( HttpStatus . OK )
56- async deletePage ( @Param ( 'id' ) id : number ) : Promise < MessageResponseDto > {
58+ async deletePage (
59+ @Param ( 'id' , ParseIntPipe ) id : number ,
60+ ) : Promise < MessageResponseDto > {
5761 await this . pageService . deletePage ( id ) ;
5862 return {
5963 message : PageResponseMessage . PAGE_DELETED ,
@@ -67,7 +71,7 @@ export class PageController {
6771 @Patch ( '/:id' )
6872 @HttpCode ( HttpStatus . OK )
6973 async updatePage (
70- @Param ( 'id' ) id : number ,
74+ @Param ( 'id' , ParseIntPipe ) id : number ,
7175 @Body ( ) body : UpdatePageDto ,
7276 ) : Promise < MessageResponseDto > {
7377 await this . pageService . updatePage ( id , body ) ;
@@ -95,7 +99,9 @@ export class PageController {
9599 @ApiOperation ( { summary : '특정 페이지를 가져옵니다.' } )
96100 @Get ( '/:id' )
97101 @HttpCode ( HttpStatus . OK )
98- async findPage ( @Param ( 'id' ) id : number ) : Promise < FindPageResponseDto > {
102+ async findPage (
103+ @Param ( 'id' , ParseIntPipe ) id : number ,
104+ ) : Promise < FindPageResponseDto > {
99105 return {
100106 message : PageResponseMessage . PAGE_RETURNED ,
101107 page : await this . pageService . findPageById ( id ) ,
0 commit comments