Skip to content

Commit

Permalink
♻️Refactor: 사용자가 처음 작성한 PT 영상 게시글 조회 service 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
eunxeum committed Nov 22, 2024
1 parent b455636 commit 00c3830
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,14 @@ public BoardInfoResDto boardInfo(Long boardId) {

// (내가 작성한) 게시글 한개 조회
@Transactional
public BoardInfoResDto myBoardInfo(Long memberId, Long boardId) {
public BoardInfoResDto myBoardInfo(Long memberId) {
Member member = memberRepository.findById(memberId)
.orElseThrow(() -> new IllegalArgumentException("회원이 존재하지 않습니다."));

Board board = boardRepository.findById(boardId)
Board board = boardRepository.findFirstByWriter(member)
.orElseThrow(() -> new IllegalArgumentException("게시글이 존재하지 않습니다."));

checkBoardOwnership(member, board);

boolean isLike = boardLikeRepository.existsByBoardAndMember(board, member);

return BoardInfoResDto.of(member, board, isLike);
}

Expand Down Expand Up @@ -148,4 +145,4 @@ public Board findById(Long boardId) {
return boardRepository.findById(boardId)
.orElseThrow(() -> new IllegalArgumentException("게시글이 존재하지 않습니다."));
}
}
}

0 comments on commit 00c3830

Please sign in to comment.