Skip to content

Commit

Permalink
fix : 댓글 전체 조회 api 에서 베테랑 여부 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
bo-ram-bo-ram committed Sep 19, 2024
1 parent 0ace969 commit e007069
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ public record CommentGetResponse(

String commentContent,

String commentDate,

boolean isVeteran
String commentDate

) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import com.pickple.server.api.guest.repository.GuestRepository;
import com.pickple.server.api.host.domain.Host;
import com.pickple.server.api.host.repository.HostRepository;
import com.pickple.server.api.moim.domain.enums.MoimState;
import com.pickple.server.api.moim.repository.MoimRepository;
import com.pickple.server.api.notice.domain.Notice;
import com.pickple.server.api.notice.repository.NoticeRepository;
import java.time.format.DateTimeFormatter;
Expand All @@ -28,7 +26,6 @@ public class CommentQueryService {
private final CommentRepository commentRepository;
private final HostRepository hostRepository;
private final GuestRepository guestRepository;
private final MoimRepository moimRepository;

public List<CommentGetResponse> getCommentListByNotice(Long noticeId) {
Notice notice = noticeRepository.findNoticeByIdOrThrow(noticeId);
Expand All @@ -48,8 +45,6 @@ public List<CommentGetResponse> getCommentListByNotice(Long noticeId) {
.commenterNickname(commenterInfo.getProfileNickname())
.commentContent(comment.getCommentContent())
.commentDate(comment.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy.MM.dd HH:mm:ss")))
.isVeteran(checkVeteran(isOwner,
hostRepository.findHostByUserId(comment.getCommenter().getId()).getId()))
.build();
}).collect(Collectors.toList());
}
Expand All @@ -69,11 +64,4 @@ public boolean checkOwner(Long userId, Long noticeId) {
return notice.getMoim().getHost().getUser().getId().equals(userId);
}

private boolean checkVeteran(boolean isOwner, Long hostId) {
if (isOwner) {
int count = moimRepository.countByHostIdAndMoimState(hostId, MoimState.COMPLETED.getMoimState());
return count >= 2;
}
return false;
}
}

0 comments on commit e007069

Please sign in to comment.