Skip to content

Commit

Permalink
v2.1.6
Browse files Browse the repository at this point in the history
v2.1.6
  • Loading branch information
mikekks authored Oct 13, 2024
2 parents 6d7115e + 91f12c4 commit f554e8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public void decreaseLikeCount() {
this.likeCount--;
}

public void increaseViewCount() {
this.viewCount++;
}

public void isWriter(Integer userId) {
if (!this.userId.equals(userId)) {
throw new ForbiddenException(FORBIDDEN_EXCEPTION.getErrorCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,16 @@ public PostV2GetPostsResponseDto getPosts(PostGetPostsCommand queryCommand, Inte
/**
* 모임 게시글 단건 조회
*
* @throws 400
* @apiNote 모임에 속한 유저만 작성 가능
* @throws 400 모임이 존재하지 않은 경우
* @apiNote 게시믈 조회 시, 조회수가 1 증가한다.
*/
@Override
@Transactional(readOnly = true)
@Transactional
public PostDetailBaseDto getPost(Integer userId, Integer postId) {
return postRepository.findPost(userId, postId);
PostDetailBaseDto responseDto = postRepository.findPost(userId, postId);
Post post = postRepository.findByIdOrThrow(postId);
post.increaseViewCount();
return responseDto;
}

@Override
Expand Down

0 comments on commit f554e8d

Please sign in to comment.