-
Notifications
You must be signed in to change notification settings - Fork 1
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
4 changed files
with
72 additions
and
21 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
28 changes: 27 additions & 1 deletion
28
src/main/java/com/umc/DongnaeFriend/domain/dongnae/dto/DongnaeCommentDto.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 |
---|---|---|
@@ -1,13 +1,39 @@ | ||
package com.umc.DongnaeFriend.domain.dongnae.dto; | ||
|
||
import com.umc.DongnaeFriend.domain.dongnae.entity.DongnaeComment; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class DongnaeCommentDto { | ||
Long parentCommentId; | ||
String content; | ||
|
||
public static DongnaeCommentDto from(DongnaeComment dongnaeComment) { | ||
return new DongnaeCommentDto( | ||
dongnaeComment.getContent() | ||
); | ||
} | ||
@Getter | ||
public static class CommentListResponse { | ||
private List<DongnaeCommentDto> list; | ||
|
||
public CommentListResponse(List<DongnaeCommentDto> list) { | ||
this.list = list; | ||
} | ||
|
||
public static CommentListResponse of(List<DongnaeComment> list) { | ||
List<DongnaeCommentDto> dongnaeCommentDtos = list | ||
.stream() | ||
.map(DongnaeCommentDto::from) | ||
.collect(Collectors.toList()); | ||
|
||
return new CommentListResponse(dongnaeCommentDtos); | ||
} | ||
} | ||
} |
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