Skip to content

Commit

Permalink
fix: avoid null problem
Browse files Browse the repository at this point in the history
  • Loading branch information
weejinyoung committed Dec 19, 2024
1 parent d16eabd commit b90019e
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.peauty.domain.review.ReviewRating;
import lombok.Builder;

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

@Builder
Expand All @@ -17,14 +18,23 @@ public record RegisterReviewCommand(
List<String> reviewImages
) {

private List<String> checkAndGetReviewImages() {
if (reviewImages == null) {
return List.of();
}
return reviewImages;
}

public Review toReview(Long threadId){

return Review.builder()
.id(null)
.threadId(new BiddingThread.ID(threadId))
.reviewRating(reviewRating)
.contentDetail(contentDetail)
.contentGenerals(contentGenerals)
.reviewImages(reviewImages.stream()
.reviewImages(
checkAndGetReviewImages().stream()
.map(imageUrl -> ReviewImage.builder()
.id(null)
.reviewId(null)
Expand Down

0 comments on commit b90019e

Please sign in to comment.