Skip to content

Commit 96c05a5

Browse files
refactor: parseIntPipe 필요한 컨트롤러 함수에 추가
1 parent a3fd0c9 commit 96c05a5

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

backend/src/node/node.controller.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ export class NodeController {
8989
})
9090
@Delete('/:id')
9191
@HttpCode(HttpStatus.OK)
92-
async deleteNode(@Param('id') id: number): Promise<{ message: string }> {
92+
async deleteNode(
93+
@Param('id', ParseIntPipe) id: number,
94+
): Promise<{ message: string }> {
9395
await this.nodeService.deleteNode(id);
9496
return {
9597
message: NodeResponseMessage.NODE_DELETED,
@@ -103,7 +105,7 @@ export class NodeController {
103105
@Patch('/:id')
104106
@HttpCode(HttpStatus.OK)
105107
async updateNode(
106-
@Param('id') id: number,
108+
@Param('id', ParseIntPipe) id: number,
107109
@Body() body: UpdateNodeDto,
108110
): Promise<{ message: string }> {
109111
await this.nodeService.updateNode(id, body);
@@ -128,7 +130,10 @@ export class NodeController {
128130

129131
@Patch('/:id/move')
130132
@HttpCode(HttpStatus.OK)
131-
async moveNode(@Param('id') id: number, @Body() body: MoveNodeDto) {
133+
async moveNode(
134+
@Param('id', ParseIntPipe) id: number,
135+
@Body() body: MoveNodeDto,
136+
) {
132137
await this.nodeService.moveNode(id, body);
133138
return {
134139
message: NodeResponseMessage.NODE_MOVED,

backend/src/page/page.controller.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Body,
99
HttpCode,
1010
HttpStatus,
11+
ParseIntPipe,
1112
} from '@nestjs/common';
1213
import { PageService } from './page.service';
1314
import { CreatePageDto } from './dtos/createPage.dto';
@@ -28,6 +29,7 @@ export enum PageResponseMessage {
2829
@Controller('page')
2930
export 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

Comments
 (0)