Skip to content

Commit 7d223ad

Browse files
authored
Dev > main 브랜치 병합
댓글 response 추가 후 테스트 과정 거친 후에 Dev 브랜치에서 main 브랜치로 병합합니다.
2 parents 217cc13 + 2585698 commit 7d223ad

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/main/java/hs/kr/backend/devpals/domain/project/dto/CommentDTO.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ public class CommentDTO {
2828

2929
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
3030
@Schema(description = "대댓글 수", example = "0", accessMode = Schema.AccessMode.READ_ONLY)
31-
private int commentCount;
31+
private int recommentCount;
3232

33-
public static CommentDTO fromEntity(CommentEntity comment) {
33+
public static CommentDTO fromEntity(CommentEntity comment, int recommentCount) {
3434
return CommentDTO.builder()
3535
.id(comment.getId())
3636
.content(comment.getContent())
3737
.user(ProjectUserResponse.fromEntity(comment.getUser()))
38-
.commentCount(0)
38+
.recommentCount(recommentCount)
3939
.build();
4040
}
4141
}

src/main/java/hs/kr/backend/devpals/domain/project/repository/RecommentRepository.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77

88
public interface RecommentRepository extends JpaRepository<RecommentEntity, Long> {
99
List<RecommentEntity> findAllByCommentId(Long commentId);
10+
int countByCommentId(Long commentId);
1011
}

src/main/java/hs/kr/backend/devpals/domain/project/service/ProjectCommentService.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ public ResponseEntity<ApiResponse<List<CommentDTO>>> getComment(Long projectId)
5757

5858
List<CommentEntity> comments = commentRepoisitory.findAllByProjectId(projectId);
5959

60-
List<CommentDTO> response = commentRepoisitory.findAllByProjectId(projectId).stream()
61-
.map(CommentDTO::fromEntity)
60+
List<CommentDTO> response = comments.stream()
61+
.map(comment -> {
62+
int recommentCount = recommentRepository.countByCommentId(comment.getId());
63+
return CommentDTO.fromEntity(comment, recommentCount);
64+
})
6265
.collect(Collectors.toList());
6366

6467
return ResponseEntity.ok(new ApiResponse<>(true, "댓글 가져오기 성공", response));

src/main/java/hs/kr/backend/devpals/domain/user/service/AlarmService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private String makeMessage(ProjectEntity project,UserEntity commenter) {
124124

125125
private String makeMessage(ApplicantEntity applicant) {
126126
String result = applicant.getStatus().equals(ApplicantStatus.ACCEPTED) ? "합격" : "불합격";
127-
127+
128128
return "내가 지원한 '"+applicant.getProject().getTitle()+"'에 "+ result +"하셨습니다.";
129129
}
130130

0 commit comments

Comments
 (0)