Skip to content

Commit

Permalink
fix: children -> replyComments
Browse files Browse the repository at this point in the history
  • Loading branch information
char-yb committed Oct 1, 2024
1 parent 1be4cf4 commit 589d9d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public CommentFindResponse findCommentsByRecordId(Long recordId) {

private CommentFindOneResponse convertToCommentFindOneResponse(
Comment comment, Map<Long, List<Comment>> commentsByParentId) {
List<CommentFindOneResponse> childrenResponses =
List<CommentFindOneResponse> replyCommentsResponses =
commentsByParentId.getOrDefault(comment.getId(), List.of()).stream()
.map(
childComment ->
Expand All @@ -109,7 +109,7 @@ private CommentFindOneResponse convertToCommentFindOneResponse(
comment.getWriter().getProfile().getNickname(),
comment.getWriter().getProfile().getProfileImageUrl(),
comment.getCreatedAt().toString(),
childrenResponses);
replyCommentsResponses);
}

private MissionRecord findMissionRecordById(Long recordId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public List<Comment> findAllCommentsByMissionRecord(MissionRecord missionRecord)
.selectFrom(comment)
.leftJoin(comment.parent)
.fetchJoin()
.leftJoin(comment.children)
.leftJoin(comment.replyComments)
.fetchJoin()
.where(comment.missionRecord.eq(missionRecord))
.fetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Comment extends BaseTimeEntity {

// 자식 댓글
@OneToMany(mappedBy = "parent", orphanRemoval = true)
private List<Comment> children = new ArrayList<>();
private List<Comment> replyComments = new ArrayList<>();

@Builder(access = AccessLevel.PRIVATE)
public Comment(MissionRecord missionRecord, Member writer, String content, Comment parent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public record CommentFindOneResponse(
@Schema(description = "작성자 프로필 이미지 URL", example = "https://default.walwal/profile.jpg")
String writerProfileImageUrl,
@Schema(description = "작성일", example = "2021-10-01T00:00:00") String createdAt,
@Schema(description = "자식 댓글 목록") List<CommentFindOneResponse> children) {
@Schema(description = "자식 댓글 목록") List<CommentFindOneResponse> replyComments) {
public static CommentFindOneResponse of(
Long parentId,
Long commentId,
Expand All @@ -21,7 +21,7 @@ public static CommentFindOneResponse of(
String writerNickname,
String writerProfileImageUrl,
String createdAt,
List<CommentFindOneResponse> children) {
List<CommentFindOneResponse> replyComments) {
return new CommentFindOneResponse(
parentId,
commentId,
Expand All @@ -30,6 +30,6 @@ public static CommentFindOneResponse of(
writerNickname,
writerProfileImageUrl,
createdAt,
children);
replyComments);
}
}

0 comments on commit 589d9d6

Please sign in to comment.