diff --git a/src/main/java/com/cmc/suppin/event/crawl/controller/CrawlApi.java b/src/main/java/com/cmc/suppin/event/crawl/controller/CrawlApi.java index 000a95e..babf7d2 100644 --- a/src/main/java/com/cmc/suppin/event/crawl/controller/CrawlApi.java +++ b/src/main/java/com/cmc/suppin/event/crawl/controller/CrawlApi.java @@ -33,8 +33,8 @@ public class CrawlApi { "Response
" + "- 요청된 URL과 중복된 댓글 수집 이력이 있을 경우 '검증 및 확인되었습니다.' 출력
" + "- 요청된 URL과 중복된 댓글 수집 이력이 없을 경우 '수집 이력이 없습니다.' 출력") - public ResponseEntity> checkExistingComments(@RequestParam String url, @RequestParam Long eventId, @CurrentAccount Account account) { - String message = crawlService.checkExistingComments(url, eventId, account.userId()); + public ResponseEntity> checkExistingComments(@RequestParam String url, @CurrentAccount Account account) { + String message = crawlService.checkExistingComments(url, account.userId()); if (message != null) { return ResponseEntity.ok(ApiResponse.of(ResponseCode.SUCCESS, message)); } diff --git a/src/main/java/com/cmc/suppin/event/crawl/service/CrawlService.java b/src/main/java/com/cmc/suppin/event/crawl/service/CrawlService.java index 597f62c..9802302 100644 --- a/src/main/java/com/cmc/suppin/event/crawl/service/CrawlService.java +++ b/src/main/java/com/cmc/suppin/event/crawl/service/CrawlService.java @@ -39,14 +39,11 @@ public class CrawlService { private final EventRepository eventRepository; private final MemberRepository memberRepository; - public String checkExistingComments(String url, Long eventId, String userId) { + public String checkExistingComments(String url, String userId) { Member member = memberRepository.findByUserIdAndStatusNot(userId, UserStatus.DELETED) .orElseThrow(() -> new IllegalArgumentException("Member not found")); - Event event = eventRepository.findByIdAndMemberId(eventId, member.getId()) - .orElseThrow(() -> new IllegalArgumentException("Event not found")); - - List existingComments = commentRepository.findByUrlAndEventId(url, eventId); + List existingComments = commentRepository.findByUrl(url); if (!existingComments.isEmpty()) { LocalDateTime firstCommentDate = existingComments.get(0).getCreatedAt(); return "동일한 URL의 댓글을 " + firstCommentDate.toLocalDate() + " 일자에 수집한 이력이 있습니다.";