Skip to content

Commit

Permalink
Merge branch 'main' into feat/user-login
Browse files Browse the repository at this point in the history
  • Loading branch information
shinhn committed Jan 13, 2023
2 parents 633265e + 6f5f992 commit a0070fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public class GetBoardRes {
@ApiParam(value = "참여 유저 이미지 url 리스트")
private List<String> userImageUrls;

@ApiModelProperty(example = "false", value = "요청 유저의 보드 참여 여부")
private Boolean isJoinedUser;

@ApiModelProperty(example = "ACTIVE")
@ApiParam(value = "객체 상태")
private BaseStatus status;
Expand All @@ -128,7 +131,7 @@ public class GetBoardRes {
연관관계 편의 메서드
*/
@Builder
public GetBoardRes(Long boardId, Long cityId, String cityName, Long hostId, String hostName, String profileImgUrl, String title, String address, String addressDetail, float longitute, float latitude, LocalDateTime date, String notice, String introduction, String kindOfPerson, int currentMember, int totalMember, Long categoryId, String categoryName, List<String> imageUrls, List<Long> imageIds, List<Long> userIds, List<String> userImageUrls, BaseStatus status, String createdAt, String updatedAt) {
public GetBoardRes(Long boardId, Long cityId, String cityName, Long hostId, String hostName, String profileImgUrl, String title, String address, String addressDetail, float longitute, float latitude, LocalDateTime date, String notice, String introduction, String kindOfPerson, int currentMember, int totalMember, Long categoryId, String categoryName, List<String> imageUrls, List<Long> imageIds, List<Long> userIds, List<String> userImageUrls, Boolean isJoinedUser, BaseStatus status, String createdAt, String updatedAt) {
this.boardId = boardId;
this.cityId = cityId;
this.cityName = cityName;
Expand All @@ -152,13 +155,14 @@ public GetBoardRes(Long boardId, Long cityId, String cityName, Long hostId, Stri
this.imageIds = imageIds;
this.userIds = userIds;
this.userImageUrls = userImageUrls;
this.isJoinedUser = isJoinedUser;
this.status = status;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}


public static GetBoardRes toDto(Board board, List<String> imageUrls, String profileImgUrl, List<User> users, List<String> userImageUrls){
public static GetBoardRes toDto(Board board, List<String> imageUrls, String profileImgUrl, List<User> users, List<String> userImageUrls, User user){
return GetBoardRes.builder()
.boardId(board.getId())
.cityId(board.getCity().getId())
Expand All @@ -185,6 +189,7 @@ public static GetBoardRes toDto(Board board, List<String> imageUrls, String prof
.map(image -> image.getId()).collect(Collectors.toList()))
.userIds(users.stream().map(User::getId).collect(Collectors.toList()))
.userImageUrls(userImageUrls)
.isJoinedUser(users.contains(user))
.status(board.getStatus())
.createdAt(board.getCreatedAt())
.updatedAt(board.getUpdatedAt())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,16 +356,14 @@ public ApplicationResponse<GetBoardRes> findBoard(GetBoardReq dto){
.orElseThrow(() -> new NotFoundBoardException());

List<User> participants = board.getBoardUsers().stream()
.filter(boardUser -> !boardUser.getUser().equals(board.getHost()))
.map(boardUser -> boardUser.getUser())
.collect(Collectors.toList());

List<String> participantsImageUUIds = board.getBoardUsers().stream()
.filter(boardUser -> !boardUser.getUser().equals(board.getHost()))
.map(boardUser -> boardUser.getUser().getProfileImg())
.collect(Collectors.toList());

GetBoardRes res = GetBoardRes.toDto(board, awsS3Service.makeUrlsOfFilenames(board.getBoardImagesUUids()), awsS3Service.makeUrlOfFilename(board.getHost().getProfileImg()), participants, awsS3Service.makeUrlsOfFilenames(participantsImageUUIds));
GetBoardRes res = GetBoardRes.toDto(board, awsS3Service.makeUrlsOfFilenames(board.getBoardImagesUUids()), awsS3Service.makeUrlOfFilename(board.getHost().getProfileImg()), participants, awsS3Service.makeUrlsOfFilenames(participantsImageUUIds), user);
return ApplicationResponse.ok(res);
}

Expand Down

0 comments on commit a0070fe

Please sign in to comment.