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

[develop-v2] main merge #189

Merged
merged 10 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
10 commits
Select commit Hold shift + click to select a range
4b158ee
#122 fix: κ·Έλ£Ή 멀버 이미지 쑰회 μ‹œ κ΄€λ¦¬μžκ°€ μ€‘λ³΅λ˜λŠ” 문제λ₯Ό μˆ˜μ •ν•˜κ³  κ΄€λ¦¬μžκ°€ κ°€μž₯ μ•žμ— 담기도둝 κ΅¬ν˜„
JoongHyun-Kim Jun 5, 2024
53845e1
Merge pull request #188 from lemonssoju/fix/122-getGroupProfile
JoongHyun-Kim Jun 5, 2024
1de70c1
#87 fix: 퍼즐 생성 μ‹œ 이미지가 μ—†λŠ” κ²½μš°λ„ μš”μ²­μ΄ κ°€λŠ₯ν•˜λ„λ‘ μˆ˜μ •
JoongHyun-Kim Jun 6, 2024
09ad96a
Merge pull request #190 from lemonssoju/fix/87-createPuzzle
JoongHyun-Kim Jun 6, 2024
86934f0
#87 fix: 퍼즐 생성 μ‹œ status값을 active둜 μ €μž₯ν•˜λ„λ‘ μˆ˜μ •
JoongHyun-Kim Jun 6, 2024
4d3b0be
Merge pull request #191 from lemonssoju/fix/87-createPuzzle
JoongHyun-Kim Jun 6, 2024
320cc0e
#88 fix: 앨범 상세 쑰회 μ‹œ κ΄€λ¦¬μžλ₯Ό 포함해 멀버 이미지λ₯Ό λ°˜ν™˜ν•˜λ„λ‘ μˆ˜μ •
JoongHyun-Kim Jun 6, 2024
edb4489
Merge pull request #192 from lemonssoju/fix/88-getAlbumList
JoongHyun-Kim Jun 6, 2024
7f26929
#88 fix: 앨범 상세 쑰회 μ‹œ μ°Έμ—¬ 멀버에 κ΄€λ¦¬μž μΆ”κ°€
JoongHyun-Kim Jun 6, 2024
a8cd5c2
Merge pull request #193 from lemonssoju/fix/88-getAlbumDetail
JoongHyun-Kim Jun 6, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

Expand Down Expand Up @@ -47,23 +48,32 @@ public BaseResponse<AlbumDetailResponse> getAlbumDetail(Long groupIdx, Long albu
Album album = albumRepository.findById(albumIdx).orElseThrow(() -> new BaseException(INVALID_ALBUM_IDX));
if (!album.getPuzzle().getTeam().equals(group)) throw new BaseException(NO_GROUP_ALBUM);

List<String> memberList = album.getPuzzle().getPuzzleMembers().stream()
.map(puzzleMember -> puzzleMember.getUser().getProfile().getNickname()).toList();

List<CommentDto> commentList = album.getComments().stream()
.filter(comment -> "active".equals(comment.getStatus()))
.map(comment -> new CommentDto(
comment.getCommentIdx(),
comment.getUser().getProfile().getNickname(),
comment.getUser().getProfile().getProfileImage(),
comment.getCreatedDate().toString(),
comment.getContent())).toList();
comment.getContent()))
.toList();

AlbumDetailResponse albumDetailResponse = new AlbumDetailResponse(album.getPuzzle().getTitle(), album.getPuzzle().getPuzzleDate().toString(),
album.getPuzzle().getLocation().getLocation(), memberList, album.getAlbumImage(), album.getContent(), album.getPuzzle().getPuzzleIdx(), commentList);
album.getPuzzle().getLocation().getLocation(), getMemberList(album), album.getAlbumImage(), album.getContent(), album.getPuzzle().getPuzzleIdx(), commentList);
return new BaseResponse<>(albumDetailResponse);
}

private List<String> getMemberList(Album album) {
List<String> memberList = new ArrayList<>();
memberList.add(album.getPuzzle().getUser().getProfile().getNickname());

memberList.addAll(
album.getPuzzle().getPuzzleMembers().stream()
.map(puzzleMember -> puzzleMember.getUser().getProfile().getNickname())
.toList());
return memberList;
}

// 앨범 λͺ©λ‘ 쑰회(sortType="time", "location")
public BaseResponse<?> getAlbumList(Long groupIdx, String sortType) {
Team group = groupRepository.findById(groupIdx).orElseThrow(() -> new BaseException(INVALID_GROUP_IDX));
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/com/lesso/neverland/album/dto/AlbumByTimeDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.lesso.neverland.album.domain.Album;

import java.util.ArrayList;
import java.util.List;

public record AlbumByTimeDto(Long albumIdx,
Expand All @@ -11,16 +12,26 @@ public record AlbumByTimeDto(Long albumIdx,
String puzzleDate,
Integer puzzlerCount,
List<String> puzzlerImageList) {


public static AlbumByTimeDto from(Album album) {
List<String> puzzlerImageList = new ArrayList<>();
puzzlerImageList.add(album.getPuzzle().getUser().getProfile().getProfileImage());

puzzlerImageList.addAll(
album.getPuzzle().getPuzzleMembers().stream()
.map(puzzleMember -> puzzleMember.getUser().getProfile().getProfileImage())
.limit(2)
.toList());

return new AlbumByTimeDto(
album.getAlbumIdx(),
album.getPuzzle().getTitle(),
album.getContent(),
album.getAlbumImage(),
album.getPuzzle().getPuzzleDate().toString(),
album.getPuzzle().getPuzzleMembers().size(),
album.getPuzzle().getPuzzleMembers().stream()
.map(puzzleMember -> puzzleMember.getUser().getProfile().getProfileImage()).toList()
puzzlerImageList
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ private List<String> getMemberImageList(Team group) {

List<String> memberImages = group.getUserTeams().stream()
.filter(userTeam -> "active".equals(userTeam.getStatus()))
.filter(userTeam -> !userTeam.getUser().equals(group.getAdmin()))
.map(userTeam -> userTeam.getUser().getProfile().getProfileImage())
.limit(2).toList();
.limit(2)
.toList();
imageList.addAll(memberImages);
return imageList;
}


// [κ΄€λ¦¬μž] κ·Έλ£Ή μˆ˜μ • ν™”λ©΄ 쑰회
public BaseResponse<GroupEditViewResponse> getGroupEditView(Long groupIdx) {
Team group = groupRepository.findById(groupIdx).orElseThrow(() -> new BaseException(INVALID_GROUP_IDX));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public BaseResponse<CreatePuzzleResponse> createPuzzle(Long groupIdx, MultipartF

LocalDate puzzleDate = convertToLocalDate(createPuzzleRequest.puzzleDate());
Puzzle newPuzzle = createPuzzle(createPuzzleRequest, group, writer, puzzleDate);
if (!image.isEmpty()) {
if (image != null && !image.isEmpty()) {
String imagePath = imageService.uploadImage("puzzle", image);
newPuzzle.addPuzzleImage(imagePath);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/lesso/neverland/puzzle/domain/Puzzle.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.List;

import static com.lesso.neverland.common.constants.Constants.ACTIVE;
import static com.lesso.neverland.common.constants.Constants.INACTIVE;

@Entity
Expand Down Expand Up @@ -62,6 +63,7 @@ public Puzzle(User user, Team team, String title, String content, LocalDate puzz
this.content = content;
this.puzzleDate = puzzleDate;
this.location = location;
this.setStatus(ACTIVE);
}

public void setUser(User user) {
Expand Down
Loading