-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from cvs-go/feature#82
특정 사용자가 작성한 리뷰 목록 조회 API 추가
- Loading branch information
Showing
12 changed files
with
387 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/com/cvsgo/dto/review/ReadUserReviewQueryDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.cvsgo.dto.review; | ||
|
||
import com.cvsgo.entity.ProductBookmark; | ||
import com.cvsgo.entity.ReviewLike; | ||
import com.querydsl.core.annotations.QueryProjection; | ||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ReadUserReviewQueryDto { | ||
|
||
private final Long reviewId; | ||
|
||
private final Long productId; | ||
|
||
private final String productName; | ||
|
||
private final String manufacturerName; | ||
|
||
private final String productImageUrl; | ||
|
||
private final Long reviewerId; | ||
|
||
private final String reviewerNickname; | ||
|
||
private final String reviewerProfileImageUrl; | ||
|
||
private final Long likeCount; | ||
|
||
private final Integer rating; | ||
|
||
private final String reviewContent; | ||
|
||
private final Boolean isReviewLiked; | ||
|
||
private final Boolean isProductBookmarked; | ||
|
||
private final LocalDateTime createdAt; | ||
|
||
@QueryProjection | ||
public ReadUserReviewQueryDto(Long reviewId, Long productId, String productName, | ||
String manufacturerName, String productImageUrl, Long reviewerId, String reviewerNickname, | ||
String reviewerProfileImageUrl, Long likeCount, Integer rating, | ||
String reviewContent, LocalDateTime createdAt, ReviewLike reviewLike, | ||
ProductBookmark productBookmark) { | ||
this.reviewId = reviewId; | ||
this.productId = productId; | ||
this.productName = productName; | ||
this.manufacturerName = manufacturerName; | ||
this.productImageUrl = productImageUrl; | ||
this.reviewerId = reviewerId; | ||
this.reviewerNickname = reviewerNickname; | ||
this.reviewerProfileImageUrl = reviewerProfileImageUrl; | ||
this.likeCount = likeCount; | ||
this.rating = rating; | ||
this.reviewContent = reviewContent; | ||
this.createdAt = createdAt; | ||
this.isReviewLiked = reviewLike != null; | ||
this.isProductBookmarked = productBookmark != null; | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
src/main/java/com/cvsgo/dto/review/ReadUserReviewResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package com.cvsgo.dto.review; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ReadUserReviewResponseDto { | ||
|
||
private final Long productId; | ||
|
||
private final String productName; | ||
|
||
private final String productManufacturer; | ||
|
||
private final String productImageUrl; | ||
|
||
private final Long reviewId; | ||
|
||
private final Long reviewerId; | ||
|
||
private final String reviewerNickname; | ||
|
||
private final String reviewerProfileImageUrl; | ||
|
||
private final Long reviewLikeCount; | ||
|
||
private final Integer reviewRating; | ||
|
||
private final String reviewContent; | ||
|
||
private final Boolean isReviewLiked; | ||
|
||
private final Boolean isProductBookmarked; | ||
|
||
private final List<String> reviewImageUrls; | ||
|
||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Seoul") | ||
private final LocalDateTime createdAt; | ||
|
||
@Builder | ||
public ReadUserReviewResponseDto(Long productId, String productName, String productManufacturer, | ||
String productImageUrl, Long reviewId, Long reviewerId, String reviewerNickname, | ||
String reviewerProfileImageUrl, | ||
Long reviewLikeCount, Integer reviewRating, String reviewContent, Boolean isReviewLiked, | ||
Boolean isProductBookmarked, List<String> reviewImageUrls, LocalDateTime createdAt) { | ||
this.productId = productId; | ||
this.productName = productName; | ||
this.productManufacturer = productManufacturer; | ||
this.productImageUrl = productImageUrl; | ||
this.reviewId = reviewId; | ||
this.reviewerId = reviewerId; | ||
this.reviewerNickname = reviewerNickname; | ||
this.reviewerProfileImageUrl = reviewerProfileImageUrl; | ||
this.reviewLikeCount = reviewLikeCount; | ||
this.reviewRating = reviewRating; | ||
this.reviewContent = reviewContent; | ||
this.isReviewLiked = isReviewLiked; | ||
this.isProductBookmarked = isProductBookmarked; | ||
this.reviewImageUrls = reviewImageUrls; | ||
this.createdAt = createdAt; | ||
} | ||
|
||
public static ReadUserReviewResponseDto of(ReadUserReviewQueryDto readUserReviewQueryDto, | ||
List<String> reviewImageUrls) { | ||
return ReadUserReviewResponseDto.builder() | ||
.productName(readUserReviewQueryDto.getProductName()) | ||
.productId(readUserReviewQueryDto.getProductId()) | ||
.reviewContent(readUserReviewQueryDto.getReviewContent()) | ||
.productImageUrl(readUserReviewQueryDto.getProductImageUrl()) | ||
.productManufacturer(readUserReviewQueryDto.getManufacturerName()) | ||
.reviewId(readUserReviewQueryDto.getReviewId()) | ||
.reviewerId(readUserReviewQueryDto.getReviewerId()) | ||
.reviewerNickname(readUserReviewQueryDto.getReviewerNickname()) | ||
.reviewerProfileImageUrl(readUserReviewQueryDto.getReviewerProfileImageUrl()) | ||
.reviewRating(readUserReviewQueryDto.getRating()) | ||
.reviewLikeCount(readUserReviewQueryDto.getLikeCount()) | ||
.createdAt(readUserReviewQueryDto.getCreatedAt()) | ||
.isProductBookmarked(readUserReviewQueryDto.getIsProductBookmarked()) | ||
.isReviewLiked(readUserReviewQueryDto.getIsReviewLiked()) | ||
.reviewImageUrls(reviewImageUrls) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.