Skip to content

Commit

Permalink
Merge pull request #152 from Gamegoo-repo/feat/151
Browse files Browse the repository at this point in the history
[Feat/151] ๊ฒŒ์‹œํŒ ๊ด€๋ จ ์ถ”๊ฐ€ ๊ตฌํ˜„ ๋ฐ ์ˆ˜์ •
  • Loading branch information
hzee97 authored Aug 10, 2024
2 parents 8c98a74 + 64c90c4 commit 126e5db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/gamegoo/dto/board/BoardResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public static class boardByIdResponseForMemberDTO {
Long boardId;
Long memberId;
Boolean isBlocked;
Boolean isFriend;
LocalDateTime createdAt;
Integer profileImage;
String gameName;
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/com/gamegoo/service/board/BoardService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import com.gamegoo.repository.board.BoardRepository;
import com.gamegoo.repository.member.GameStyleRepository;
import com.gamegoo.repository.member.MemberRepository;
import com.gamegoo.service.member.FriendService;
import com.gamegoo.util.MemberUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
Expand All @@ -33,6 +35,8 @@
@Service
@RequiredArgsConstructor
public class BoardService {
@Autowired
private FriendService friendService;
private final MemberRepository memberRepository;
private final BoardRepository boardRepository;
private final GameStyleRepository gameStyleRepository;
Expand Down Expand Up @@ -301,7 +305,7 @@ public BoardResponse.boardByIdResponseDTO getBoardById(Long boardId) {
.wantPosition(board.getWantPosition())
.recentGameCount(poster.getGameCount())
.winRate(poster.getWinRate())
.gameStyles(board.getBoardGameStyles().stream().map(BoardGameStyle::getId).collect(Collectors.toList()))
.gameStyles(board.getBoardGameStyles().stream().map(boardGameStyle -> boardGameStyle.getGameStyle().getId()).collect(Collectors.toList()))
.contents(board.getContent())
.build();

Expand All @@ -321,6 +325,7 @@ public BoardResponse.boardByIdResponseForMemberDTO getBoardByIdForMember(Long bo
.boardId(board.getId())
.memberId(poster.getId())
.isBlocked(MemberUtils.isBlocked(member, poster))
.isFriend(friendService.isFriend(member,poster))
.createdAt(board.getCreatedAt())
.profileImage(board.getBoardProfileImage())
.gameName(poster.getGameName())
Expand All @@ -335,7 +340,7 @@ public BoardResponse.boardByIdResponseForMemberDTO getBoardByIdForMember(Long bo
.wantPosition(board.getWantPosition())
.recentGameCount(poster.getGameCount())
.winRate(poster.getWinRate())
.gameStyles(board.getBoardGameStyles().stream().map(BoardGameStyle::getId).collect(Collectors.toList()))
.gameStyles(board.getBoardGameStyles().stream().map(boardGameStyle -> boardGameStyle.getGameStyle().getId()).collect(Collectors.toList()))
.contents(board.getContent())
.build();
}
Expand Down

0 comments on commit 126e5db

Please sign in to comment.