Skip to content

[BE-211] 내 댓글 관리기능의 내가 작성한 댓글을 조회하는 API 개발#164

Merged
kdomo merged 2 commits intodevelopfrom
feature/BE-211
Feb 27, 2023
Merged

[BE-211] 내 댓글 관리기능의 내가 작성한 댓글을 조회하는 API 개발#164
kdomo merged 2 commits intodevelopfrom
feature/BE-211

Conversation

@Pull-Stack
Copy link
Copy Markdown
Contributor

@Pull-Stack Pull-Stack commented Feb 17, 2023

관련 이슈 번호

설명

내 댓글 관리기능의 내가 작성한 댓글을 조회하는 API를 개발하였습니다.

변경사항

  • 코드리뷰 피드백을 반영하여 코드를 수정하였습니다.

질문사항

@Pull-Stack Pull-Stack added ✨ Feature 기능 개발 ✅ Test 테스트 labels Feb 17, 2023
Copy link
Copy Markdown
Member

@kdomo kdomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로직은 잘 짜주셨어용 👍🏻
로직 외적으로 수정할 부분 코멘트 남겨놓겠습니당

Comment on lines +32 to +40
@Builder
public MyCommentResponseDto(Page<Comment> comments) {
totalPage = comments.getTotalPages();
totalCount = comments.getTotalElements();
myCommentDtos = comments.getContent().stream()
.map(
comment -> MyCommentDto.builder().comment(comment).build()
).collect(Collectors.toList());
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Builder
public MyCommentResponseDto(Page<Comment> comments) {
totalPage = comments.getTotalPages();
totalCount = comments.getTotalElements();
myCommentDtos = comments.getContent().stream()
.map(
comment -> MyCommentDto.builder().comment(comment).build()
).collect(Collectors.toList());
}
private MyCommentResponseDto(
Integer totalPage,
Long totalCount,
List<MyCommentDto> myCommentDtos
) {
this.totalPage = totalPage;
this.totalCount = totalCount;
this.myCommentDtos = myCommentDtos;
}
public static MyCommentResponseDto of(Page<Comment> comments) {
return new MyCommentResponseDto(
comments.getTotalPages(),
comments.getTotalElements(),
comments.getContent().stream()
.map(
comment -> MyCommentDto.of(comment)
).collect(Collectors.toList())
);
}

Comment on lines +236 to +238
return MyCommentResponseDto.builder()
.comments(findComments)
.build();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return MyCommentResponseDto.builder()
.comments(findComments)
.build();
return MyCommentResponseDto.of(findComments);

Comment on lines +44 to +54
@Builder
public MyCommentDto(Comment comment) {
this.categoryName = comment.getRecord().getRecordCategory().getName();
this.recordId = comment.getRecord().getId();
this.title = comment.getRecord().getTitle();
this.iconName = comment.getRecord().getRecordIcon().getName();
this.colorName = comment.getRecord().getRecordColor().getName();
this.recordCreatedAt = comment.getRecord().getCreatedAt();
this.commentContent = comment.getContent();
this.commentCreatedAt = comment.getCreatedAt();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Builder
public MyCommentDto(Comment comment) {
this.categoryName = comment.getRecord().getRecordCategory().getName();
this.recordId = comment.getRecord().getId();
this.title = comment.getRecord().getTitle();
this.iconName = comment.getRecord().getRecordIcon().getName();
this.colorName = comment.getRecord().getRecordColor().getName();
this.recordCreatedAt = comment.getRecord().getCreatedAt();
this.commentContent = comment.getContent();
this.commentCreatedAt = comment.getCreatedAt();
}
private MyCommentDto(
String categoryName,
Long recordId,
String title,
String iconName,
String colorName,
LocalDateTime recordCreatedAt,
String commentContent,
LocalDateTime commentCreatedAt
) {
this.categoryName = categoryName;
this.recordId = recordId;
this.title = title;
this.iconName = iconName;
this.colorName = colorName;
this.recordCreatedAt = recordCreatedAt;
this.commentContent = commentContent;
this.commentCreatedAt = commentCreatedAt;
}
public static MyCommentDto of(Comment comment) {
return new MyCommentDto(
comment.getRecord().getRecordCategory().getName(),
comment.getRecord().getId(),
comment.getRecord().getTitle(),
comment.getRecord().getRecordIcon().getName(),
comment.getRecord().getRecordColor().getName(),
comment.getRecord().getCreatedAt(),
comment.getContent(),
comment.getCreatedAt()
);
}

@Pull-Stack Pull-Stack added the 🔨 Refactor 리팩토링 label Feb 24, 2023
Copy link
Copy Markdown
Member

@kdomo kdomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 🙇🏻

@kdomo kdomo merged commit 710cdf5 into develop Feb 27, 2023
@kdomo kdomo deleted the feature/BE-211 branch February 27, 2023 10:31
@kdomo kdomo mentioned this pull request Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 개발 🔨 Refactor 리팩토링 ✅ Test 테스트

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants