inflearn logo
講義

講義

知識共有

john7212301さんの投稿

john7212301 john7212301

@john7212301

レビュー投稿数
-
平均評価
-

投稿 1

Q&A

특정 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; } 제 의도대로 수정해봤습니다.

いいね数
0
コメント数
2
閲覧数
141