ํน์ post์ ํน์ ์ฝ๋งจํธ ์กฐํ API ๊ด๋ จ ์ง๋ฌธ
//CommentController @Get(':commentId') getComment( @Param('postId', ParseIntPipe) postId: number, @Param('commentId', ParseIntPipe) commentId: number, ) { return this.commentsService.getCommentById(postId, commentId); } //-------------------------------------------------------------- //CommentService async getCommentById(postId: number, commentId: number) { const post = await this.postsService.getPostById(postId); const comment = await this.commentsRepository.findOne({ ...DEFAULT_COMMENT_FIND_OPTIONS, where: { post: { id: post.id, }, id: commentId, }, }); if (!comment) { throw new BadRequestException( `id: ${commentId} Comment๋ ์กด์ฌํ์ง ์์ต๋๋ค.`, ); } return comment; }์ ์๋๋๋ก ์์ ํด๋ดค์ต๋๋ค.