Skip to content

Commit

Permalink
fix: Comment 엔티티에서 제거한 reportedCount로 인한 컴파일 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanjaemo committed Dec 15, 2024
1 parent a56a4d2 commit 55bdd9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
8 changes: 1 addition & 7 deletions src/main/java/balancetalk/comment/dto/CommentDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import balancetalk.vote.domain.VoteOption;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

public class CommentDto {
@Data
@Builder
Expand All @@ -32,7 +31,6 @@ public Comment toEntity(Member member, TalkPick talkPick) {
.talkPick(talkPick)
.isBest(false)
.viewStatus(ViewStatus.NORMAL)
.reportedCount(0)
.isNotifiedForFirstReply(false)
.editedAt(LocalDateTime.now())
.isEdited(false)
Expand All @@ -46,7 +44,6 @@ public Comment toEntity(Member member, TalkPick talkPick, Comment parent) {
.talkPick(talkPick)
.isBest(false)
.viewStatus(ViewStatus.NORMAL)
.reportedCount(0)
.parent(parent)
.isEdited(false)
.build();
Expand Down Expand Up @@ -128,7 +125,6 @@ public static LatestCommentResponse fromEntity(Comment comment, VoteOption voteO
.likesCount(likesCount)
.myLike(myLike)
.replyCount(comment.getReplies() == null ? 0 : comment.getReplies().size())
.reportedCount(comment.getReportedCount())
.isEdited(comment.isEdited())
.createdAt(comment.getCreatedAt())
.lastModifiedAt(comment.getLastModifiedAt())
Expand Down Expand Up @@ -202,7 +198,6 @@ public static BestCommentResponse fromEntity(Comment comment, VoteOption voteOpt
.likesCount(likesCount)
.myLike(myLike)
.replyCount(comment.getReplies() == null ? 0 : comment.getReplies().size())
.reportedCount(comment.getReportedCount())
.isBest(comment.getIsBest())
.isEdited(comment.isEdited())
.createdAt(comment.getCreatedAt())
Expand Down Expand Up @@ -278,7 +273,6 @@ public static CommentReplyResponse fromEntity(Comment comment, VoteOption voteOp
.myLike(myLike)
.parentId(comment.getParent() == null ? null : comment.getParent().getId())
.replyCount(comment.getReplies() == null ? 0 : comment.getReplies().size())
.reportedCount(comment.getReportedCount())
.isEdited(comment.isEdited())
.createdAt(comment.getCreatedAt())
.lastModifiedAt(comment.getLastModifiedAt())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
import org.springframework.stereotype.Component;
import java.io.IOException;

@Component
@RequiredArgsConstructor
public class CustomSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {

@Value("${urls.redirect}")
private String redirectUrl;

private final JwtTokenProvider jwtTokenProvider;
private final MemberRepository memberRepository;
@Value("${urls.redirect}")
private String redirectUrl;

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package balancetalk.report.application;

import static balancetalk.global.exception.ErrorCode.ALREADY_REPORTED_COMMENT;
import static balancetalk.global.exception.ErrorCode.NOT_FOUND_COMMENT;
import static balancetalk.global.exception.ErrorCode.NOT_FOUND_COMMENT_AT_THAT_TALK_PICK;
import static balancetalk.global.exception.ErrorCode.REPORT_MY_COMMENT;

import balancetalk.comment.domain.Comment;
import balancetalk.comment.domain.CommentRepository;
import balancetalk.global.exception.BalanceTalkException;
Expand All @@ -14,8 +19,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static balancetalk.global.exception.ErrorCode.*;

@Service
@Transactional
@RequiredArgsConstructor
Expand Down Expand Up @@ -48,7 +51,6 @@ public void createCommentReport(@Valid CreateReportRequest createReportRequest,
Report report = createReportRequest.toEntity(reporter, reported, resourceId, comment.getContent());

reportRepository.save(report);
comment.incrementReportCount();
}

private Comment validateCommentOnTalkPick(Long resourceId, Long talkPickId) {
Expand Down

0 comments on commit 55bdd9d

Please sign in to comment.