Skip to content

Commit

Permalink
[feat] : 댓글 수정 가능한지 필드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackBean99 committed Sep 3, 2023
1 parent ec905e2 commit 6319368
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 6 deletions.
Binary file modified server/.gradle/7.6.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified server/.gradle/7.6.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified server/.gradle/7.6.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified server/.gradle/7.6.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified server/.gradle/7.6.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified server/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public List<CommentPairVo> findByCardId(Long cardId) {
.map(
comment -> {
boolean isLiked = commentLikeLoadPort.getByIdpId(currentUserId);
Boolean canEdit = comment.getInterviewerId().equals(currentUserId);
String interviewerName =
interviewers.stream()
.filter(
Expand All @@ -145,8 +146,7 @@ public List<CommentPairVo> findByCardId(Long cardId) {
.findFirst()
.map(Interviewer::getName)
.orElse("");

return CommentPairVo.of(comment, isLiked, interviewerName);
return CommentPairVo.of(comment, isLiked, interviewerName, canEdit);
})
.collect(Collectors.toList());
}
Expand Down Expand Up @@ -192,6 +192,7 @@ public List<CommentPairVo> findByApplicantId(String applicantId) {
&& commentLike
.getIdpId()
.equals(idpId));
Boolean canEdit = comment.getInterviewerId().equals(idpId);
String interviewersName =
interviewers.stream()
.filter(
Expand All @@ -202,7 +203,7 @@ public List<CommentPairVo> findByApplicantId(String applicantId) {
.findFirst()
.map(Interviewer::getName)
.orElse("");
return CommentPairVo.of(comment, isLiked, interviewersName);
return CommentPairVo.of(comment, isLiked, interviewersName, canEdit);
})
.collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public TokenResponse execute(LoginRequestDto loginRequestDto) {
public TokenResponse refresh(String refreshToken) {
Long idpId = jwtTokenProvider.parseRefreshToken(refreshToken);
Interviewer account = interviewerLoadPort.loadInterviewById(idpId);
return jwtTokenProvider.createToken(account.getId(), account.getRole().name());
return jwtTokenProvider. createToken(account.getId(), account.getRole().name());
}

private void checkPassword(String password, String encodePassword) {
Expand Down Expand Up @@ -69,4 +69,4 @@ public void changePassword(String password) {
String encededPassword = passwordEncoder.encode(password);
interviewerLoadPort.loadInterviewById(userId).changePassword(encededPassword);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class Comment extends BaseTimeEntity {
@Column(name = "idp_id")
private Long idpId;

@Column(name = "interviewer_id")
private String interviewerId;

public void delete() {
this.isDeleted = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
@Getter
@Builder
public class CommentPairVo {
// commentId
private Long id;
private LocalDateTime createdAt;
private String interviewerName;
private String content;
private Boolean isLike;
private Integer likeCount;
private Boolean canEdit;

public static CommentPairVo of(Comment comment, Boolean isLike, String interviewerName) {
public static CommentPairVo of(Comment comment, Boolean isLike, String interviewerName, Boolean canEdit) {
return CommentPairVo.builder()
.id(comment.getId())
.createdAt(comment.getCreatedAt())
Expand Down

0 comments on commit 6319368

Please sign in to comment.