Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/151] 게시판 관련 추가 구현 및 수정 #152

Merged
merged 2 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading