Skip to content

Commit

Permalink
Revert "refactor: 리뷰 응답에 장소 이름 추가"
Browse files Browse the repository at this point in the history
This reverts commit e7c5d0f.
  • Loading branch information
SonMinGyu committed Aug 16, 2023
1 parent e982678 commit f3311d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
import org.prography.kagongsillok.member.application.exception.NotFoundMemberException;
import org.prography.kagongsillok.member.domain.Member;
import org.prography.kagongsillok.member.domain.MemberRepository;
import org.prography.kagongsillok.place.application.exception.NotFoundPlaceException;
import org.prography.kagongsillok.place.domain.Place;
import org.prography.kagongsillok.place.domain.PlaceRepository;
import org.prography.kagongsillok.review.application.dto.ReviewCreateCommand;
import org.prography.kagongsillok.review.application.dto.ReviewDto;
import org.prography.kagongsillok.review.application.dto.ReviewUpdateCommand;
Expand All @@ -36,7 +33,6 @@ public class ReviewService {
private final ReviewTagRepository reviewTagRepository;
private final MemberRepository memberRepository;
private final ImageRepository imageRepository;
private final PlaceRepository placeRepository;

@Transactional
public ReviewDto createReview(final ReviewCreateCommand reviewCreateCommand) {
Expand Down Expand Up @@ -80,9 +76,8 @@ public List<ReviewDto> getAllReviewsByMemberId(final Long memberId) {
for (Review review : reviews) {
final Member member = memberRepository.findById(review.getMemberId())
.orElseThrow(() -> new NotFoundMemberException(review.getMemberId()));
final Place place = placeRepository.findById(review.getPlaceId())
.orElseThrow(() -> new NotFoundPlaceException(review.getPlaceId()));
reviewDtos.add(ReviewDto.of(review, member, getImages(review), place));

reviewDtos.add(ReviewDto.of(review, member, getImages(review)));
}

return reviewDtos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import lombok.NoArgsConstructor;
import org.prography.kagongsillok.image.domain.Image;
import org.prography.kagongsillok.member.domain.Member;
import org.prography.kagongsillok.place.domain.Place;
import org.prography.kagongsillok.review.domain.Review;
import org.prography.kagongsillok.review.domain.ReviewTagMapping;
import org.prography.kagongsillok.review.domain.ReviewTagMappings;
Expand All @@ -21,7 +20,6 @@ public class ReviewDto {
private Long id;
private Long memberId;
private Long placeId;
private String placeName;
private String memberNickName;
private String memberProfileUrl;
private int rating;
Expand All @@ -35,7 +33,6 @@ public ReviewDto(
final Long id,
final Long memberId,
final Long placeId,
final String placeName,
final String memberNickName,
final String memberProfileUrl,
final int rating,
Expand All @@ -47,7 +44,6 @@ public ReviewDto(
this.id = id;
this.memberId = memberId;
this.placeId = placeId;
this.placeName = placeName;
this.memberNickName = memberNickName;
this.memberProfileUrl = memberProfileUrl;
this.rating = rating;
Expand All @@ -73,23 +69,6 @@ public static ReviewDto of(final Review review, final Member member, final List<
.build();
}

public static ReviewDto of(final Review review, final Member member, final List<Image> images, final Place place) {
return ReviewDto
.builder()
.id(review.getId())
.memberId(review.getMemberId())
.placeId(review.getPlaceId())
.placeName(place.getName())
.memberNickName(review.getMemberNickName())
.memberProfileUrl(member.getProfileImageUrl())
.rating(review.getRating())
.content(review.getContent())
.images(images)
.tagIds(getTagIds(review.getTagMappings()))
.writtenAt(review.getWrittenAt())
.build();
}

private static List<Long> getTagIds(final ReviewTagMappings reviewTags) {
List<ReviewTagMapping> reviewTagMappings = reviewTags.getValues();
List<Long> tagIds = new ArrayList<>();
Expand Down

0 comments on commit f3311d8

Please sign in to comment.