-
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.
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 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
54 changes: 54 additions & 0 deletions
54
src/main/java/com/mpnp/baechelin/review/dto/ReviewResponseDto.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,54 @@ | ||
package com.mpnp.baechelin.review.dto; | ||
|
||
import com.mpnp.baechelin.review.domain.Review; | ||
import com.mpnp.baechelin.tag.domain.Tag; | ||
import lombok.*; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter @Setter | ||
public class ReviewResponseDto { | ||
private int reviewId; // storeId | ||
private int storeId; | ||
private int userId; | ||
private Double point; | ||
|
||
private String content; | ||
private List<ReviewImageResponseDto> reviewImageUrlList; | ||
|
||
private LocalDateTime createdAt; | ||
private LocalDateTime modifiedAt; | ||
|
||
private List<TagResponseDto> tagList; | ||
|
||
public ReviewResponseDto(Review review) { | ||
this.reviewId = review.getId(); | ||
this.storeId = review.getStoreId().getId(); | ||
this.userId = review.getUserId().getId(); | ||
this.point = review.getPoint(); | ||
this.content = review.getContent(); | ||
this.createdAt = review.getCreatedAt(); | ||
this.modifiedAt = review.getModifiedAt(); | ||
this.reviewImageUrlList = review.getReviewImageList() | ||
.stream().map(ReviewImageResponseDto::new).collect(Collectors.toList()); | ||
this.tagList = review.getTagList().stream().map(TagResponseDto::new).collect(Collectors.toList()); | ||
} | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter @Setter | ||
public static class TagResponseDto{ | ||
private int id; | ||
private String tag; | ||
|
||
public TagResponseDto(Tag tag) { | ||
this.id = tag.getId(); | ||
this.tag = tag.getTag(); | ||
} | ||
} | ||
} |