Skip to content

Commit

Permalink
[feat] : comment cardId 로 조회 및 생성 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackBean99 committed Aug 30, 2023
1 parent 9767690 commit 00afcdd
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 1 deletion.
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 @@ -35,7 +35,9 @@ public class CommentService implements CommentUseCase {
@Override
@Transactional
public Comment saveComment(Comment comment) {
Long userId = SecurityUtils.getCurrentUserId();
Comment loadedComment = commentRecordPort.saveComment(comment);
loadedComment.setIdpId(userId);
// 지원서 카드면 카드 타입이지만
if (comment.isApplicantComment()) {
Card card = cardLoadPort.findByApplicantId(comment.getApplicantId());
Expand Down Expand Up @@ -164,6 +166,7 @@ public void updateCommentContent(Long commentId, String content) {
}
}

//
@Override
@Transactional(readOnly = true)
public List<CommentPairVo> findByApplicantId(String applicantId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.econovation.recruitdomain.domains.comment.domain.CommentLike;
import com.econovation.recruitdomain.domains.comment.domain.CommentLikeRepository;
import com.econovation.recruitdomain.domains.comment.domain.CommentRepository;
import com.econovation.recruitdomain.domains.comment.exception.CommentNotFoundException;
import com.econovation.recruitdomain.out.CommentLikeLoadPort;
import com.econovation.recruitdomain.out.CommentLikeRecordPort;
import com.econovation.recruitdomain.out.CommentLoadPort;
Expand Down Expand Up @@ -53,7 +54,7 @@ public List<Comment> findAll() {
public List<Comment> findByCardId(Long cardId) {
List<Comment> comments = commentRepository.findByCardId(cardId);
if (comments.isEmpty()) {
throw CardNotFoundException.EXCEPTION;
throw CommentNotFoundException.EXCEPTION;
}
return comments;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public void prePersist() {
this.isDeleted = false;
}

public void setIdpId(Long idpId) {
this.idpId = idpId;
}

public void plusLikeCount() {
this.likeCount++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class CommentRegisterDto {
@Nullable private String applicantId;
@Nullable private Long cardId;



public static Comment from(CommentRegisterDto commentRegisterDto) {
return Comment.builder()
.content(commentRegisterDto.getContent())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.econovation.recruitdomain.domains.dto;

import javax.annotation.Nullable;
import lombok.Data;
import lombok.Getter;

Expand Down

0 comments on commit 00afcdd

Please sign in to comment.