From fbf0dbe1c17790a929b80fa0d2fe618f3814e0b5 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Sat, 10 Aug 2024 14:50:34 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=ED=81=AC=EB=A1=A4=EB=A7=81=20URL=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EA=B2=80=EC=A6=9D=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=EC=8B=9C,=20URL=20=EA=B0=92=EC=9C=BC=EB=A1=9C=EB=A7=8C=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cmc/suppin/event/crawl/controller/CrawlApi.java | 4 ++-- .../com/cmc/suppin/event/crawl/service/CrawlService.java | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) 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() + " 일자에 수집한 이력이 있습니다.";