Skip to content

Commit

Permalink
Merge pull request #89 from YogitTeam/feat/report
Browse files Browse the repository at this point in the history
Feat #9 feat: 게시글 상세조회(findBoard) 보드 이미지 status=ACTIVE 조건 추가
  • Loading branch information
xhaktmchl authored Dec 6, 2022
2 parents e1fb466 + 4b9eafb commit 6e712ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ public static GetBoardRes toDto(Board board, List<String> imageUrls, String prof
.categoryId(board.getCategory().getId())
.categoryName(board.getCategory().getName())
.imageUrls(imageUrls)
.imageIds(board.getBoardImages().stream().map(image -> image.getId()).collect(Collectors.toList()))
.imageIds(board.getBoardImages().stream()
.filter(image -> image.getStatus().equals(BaseStatus.ACTIVE))
.map(image -> image.getId()).collect(Collectors.toList()))
.userIds(users.stream().map(User::getId).collect(Collectors.toList()))
.userImageUrls(userImageUrls)
.status(board.getStatus())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class Board extends BaseEntity {
@OneToMany(mappedBy = "board", cascade = CascadeType.ALL) // 보드 생성 순간 보드 유저 리스트 생성
private List<BoardUser> boardUsers = new ArrayList<>();

@OneToMany(mappedBy = "board")
@OneToMany(mappedBy = "board", cascade = CascadeType.ALL)
private List<BoardImage> boardImages = new ArrayList<>();

@ManyToOne(fetch = FetchType.LAZY)
Expand Down Expand Up @@ -165,6 +165,7 @@ public void deleteBoard(){
// BoardImage리스트의 UUID리스트만 String으로 반환
public List<String> getBoardImagesUUids(){
return this.boardImages.stream()
.filter(boardImage -> boardImage.getStatus().equals(BaseStatus.ACTIVE))
.map(boardImage -> boardImage.getImgUUid())
.collect(Collectors.toList());
}
Expand Down

0 comments on commit 6e712ae

Please sign in to comment.