Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ dependencies {

implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

// kafka 추가
implementation 'org.springframework.kafka:spring-kafka'
}

tasks.named('test') {
Expand Down
32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:
start_period: 40s
depends_on:
- redis
- kafka #추가

Comment on lines +29 to 32
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, find and display the docker-compose.yml file
find . -name "docker-compose.yml" -type f 2>/dev/null | head -20

Repository: SeeATheater/CC_Backend

Length of output: 188


🏁 Script executed:

#!/bin/bash
# Let's look at the docker-compose.yml content
find . -name "docker-compose.yml" -type f -exec wc -l {} \; 2>/dev/null

Repository: SeeATheater/CC_Backend

Length of output: 123


🏁 Script executed:

#!/bin/bash
# Read the docker-compose.yml file to see full structure
find . -name "docker-compose.yml" -type f -exec cat -n {} \; 2>/dev/null

Repository: SeeATheater/CC_Backend

Length of output: 5816


Add readiness gating for Kafka and define Kafka healthcheck.

depends_on only enforces start order, not readiness. Without a Kafka healthcheck, the suggested condition: service_healthy cannot work. The Kafka service (lines 55–83) lacks a healthcheck entirely, and app-blue/app-green (lines 29–32, 50–52) depend on Kafka without gating on readiness. This risks startup failures if the app attempts connections before Kafka is ready.

Define a Kafka healthcheck first, then gate the app services on it:

✅ Suggested adjustment

Add to Kafka service:

      kafka:
        image: confluentinc/cp-kafka:latest
        container_name: kafka
        ports:
          - "9092:9092"
          - "29092:29092"
        environment:
          ...
+       healthcheck:
+         test: ["CMD-SHELL", "kafka-broker-api-versions.sh --bootstrap-server=localhost:9092 || exit 1"]
+         interval: 10s
+         timeout: 5s
+         retries: 5
+         start_period: 30s
        volumes:
          - kafka_data:/var/lib/kafka/data
        restart: unless-stopped

Then update app services:

      depends_on:
-       - redis
-       - kafka  `#추가`
+       redis:
+         condition: service_started
+       kafka:
+         condition: service_healthy

Apply to both app-blue and app-green.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
depends_on:
- redis
- kafka #추가
depends_on:
redis:
condition: service_started
kafka:
condition: service_healthy
🤖 Prompt for AI Agents
In `@docker-compose.yml` around lines 29 - 32, The docker-compose uses depends_on
for kafka but no Kafka healthcheck exists and app-blue/app-green should wait for
Kafka readiness; add a healthcheck to the kafka service (e.g., using kafka-ready
check command or curl/kcat against broker/port and appropriate
interval/retries/start_period) and then change the app-blue and app-green
depends_on entries to reference kafka with condition: service_healthy so they
only start after the kafka healthcheck passes; update both app services to gate
on kafka's service_healthy and ensure the healthcheck command and timings are
appropriate for your Kafka startup.

app-green:
#그린 배포
Expand All @@ -48,7 +49,38 @@ services:
start_period: 40s
depends_on:
- redis
- kafka #추가

#추가
zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- "2181:2181"
restart: unless-stopped

kafka:
image: confluentinc/cp-kafka:7.5.0
container_name: kafka
depends_on:
- zookeeper
ports:
- "9092:9092" # 도커 내부 통신용
- "29092:29092" # 로컬호스트 접속용
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181

# 내부/외부 통신 분리 (중요)
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092,PLAINTEXT_HOST://0.0.0.0:29092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
restart: unless-stopped
volumes:
redis_data:
driver: local
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
package cc.backend.admin.amateurShow.service;

import cc.backend.admin.amateurShow.dto.AdminAmateurShowListResponseDTO;
import cc.backend.admin.amateurShow.dto.AdminAmateurShowRejectRequestDTO;
import cc.backend.admin.amateurShow.dto.AdminAmateurShowReviseRequestDTO;
import cc.backend.admin.amateurShow.dto.AdminAmateurShowSummaryResponseDTO;
import cc.backend.amateurShow.entity.AmateurShow;
import cc.backend.amateurShow.repository.AmateurShowRepository;
import cc.backend.apiPayLoad.ApiResponse;
import cc.backend.apiPayLoad.SliceResponse;
import cc.backend.apiPayLoad.code.status.ErrorStatus;
import cc.backend.apiPayLoad.exception.GeneralException;
import cc.backend.event.entity.ApproveShowEvent;
import cc.backend.event.entity.NewShowEvent;
import cc.backend.event.entity.RejectShowEvent;
import cc.backend.member.entity.Member;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

import static io.micrometer.common.util.StringUtils.isNotBlank;

@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import cc.backend.amateurShow.repository.AmateurShowRepository;
import cc.backend.apiPayLoad.code.status.ErrorStatus;
import cc.backend.apiPayLoad.exception.GeneralException;
import cc.backend.event.entity.ApproveShowEvent;
import cc.backend.event.entity.RejectShowEvent;
import cc.backend.kafka.event.rejectShowEvent.RejectShowEvent;
import cc.backend.member.entity.Member;
import cc.backend.kafka.event.approvalShowEvent.ApprovalShowEvent;
import cc.backend.kafka.event.approvalShowEvent.ApprovalShowProducer;
import cc.backend.notice.event.ApproveCommitEvent;
import cc.backend.notice.event.RejectCommitEvent;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.*;
Expand All @@ -25,6 +28,8 @@ public class AdminApprovalService {

private final AmateurShowRepository amateurShowRepository;
private final ApplicationEventPublisher eventPublisher;
private final ApprovalShowProducer approvalShowProducer;
private final ApplicationEventPublisher applicationEventPublisher;

@Transactional
public AdminAmateurShowSummaryResponseDTO approveShow(Long showId) {
Expand All @@ -33,8 +38,13 @@ public AdminAmateurShowSummaryResponseDTO approveShow(Long showId) {

show.approve();

Member member = show.getMember();
eventPublisher.publishEvent(new ApproveShowEvent(show, member)); //공연등록 승인 이벤트 생성
Member performer = show.getMember();

// 등록 승인 커밋 트랜잭션 이벤트 발행
eventPublisher.publishEvent(
new ApproveCommitEvent(show.getId(), performer.getId()
)
);

return AdminAmateurShowSummaryResponseDTO.from(show);
}
Expand All @@ -47,7 +57,12 @@ public AdminAmateurShowSummaryResponseDTO rejectShow(Long showId, AdminAmateurSh
show.reject(dto.getRejectReason());

Member member = show.getMember();
eventPublisher.publishEvent(new RejectShowEvent(show, member)); //공연등록 반려 이벤트 생성

// 등록 거부 커밋 트랜잭션 이벤트 발행
eventPublisher.publishEvent(
new RejectCommitEvent(show.getId(), member.getId(), show.getRejectReason()
)
);

return AdminAmateurShowSummaryResponseDTO.from(show);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,5 @@ public void reject(String rejectReason){
this.rejectReason = rejectReason;

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,7 @@ List<AmateurShow> findHotShows(
@Query("UPDATE AmateurShow s SET s.status = 'ENDED' " +
"WHERE s.status = 'ONGOING' AND s.end < :today")
int updateShowsToEnded(@Param("today") LocalDate today);

@Query("SELECT s.hashtag FROM AmateurShow s WHERE s.member.id = :memberId")
List<String> findHashtagsByMemberId(@Param("memberId") Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,28 @@
import cc.backend.amateurShow.dto.AmateurShowResponseDTO;
import cc.backend.amateurShow.dto.AmateurUpdateRequestDTO;
import cc.backend.amateurShow.entity.*;
import cc.backend.amateurShow.entity.enums.ApprovalStatus;
import cc.backend.amateurShow.repository.*;
import cc.backend.amateurShow.converter.AmateurConverter;
import cc.backend.amateurShow.dto.AmateurEnrollRequestDTO;
import cc.backend.amateurShow.dto.AmateurEnrollResponseDTO;
import cc.backend.amateurShow.repository.specification.AmateurShowSpecification;
import cc.backend.apiPayLoad.code.status.ErrorStatus;
import cc.backend.apiPayLoad.exception.GeneralException;
import cc.backend.board.entity.enums.BoardType;
import cc.backend.event.entity.NewShowEvent;
import cc.backend.image.DTO.ImageRequestDTO;
import cc.backend.image.DTO.ImageResponseDTO;
import cc.backend.image.FilePath;
import cc.backend.image.entity.Image;
import cc.backend.image.repository.ImageRepository;
import cc.backend.image.service.ImageService;
import cc.backend.member.entity.Member;
import cc.backend.member.enumerate.Role;
import cc.backend.member.repository.MemberRepository;
import cc.backend.memberLike.entity.MemberLike;
import cc.backend.memberLike.repository.MemberLikeRepository;
import cc.backend.ticket.dto.response.ReserveListResponseDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.*;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.text.Collator;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

Expand All @@ -51,10 +40,8 @@ public class AmateurServiceImpl implements AmateurService {
private final AmateurTicketRepository amateurTicketRepository;
private final AmateurStaffRepository amateurStaffRepository;
private final AmateurRoundsRepository amateurRoundsRepository;
private final MemberLikeRepository memberLikeRepository;
private final ImageService imageService;
private final ImageRepository imageRepository;
private final ApplicationEventPublisher eventPublisher; //이벤트 생성

// 소극장 공연 등록
@Transactional
Expand Down Expand Up @@ -92,18 +79,6 @@ public AmateurEnrollResponseDTO.AmateurEnrollResult enrollShow(Long memberId,

imageService.saveImageWithImageUrl(memberId, fullImageRequestDTO, Optional.ofNullable(dto.getImageUrl()));


// 좋아요한 멤버리스트
List<MemberLike> memberLikers = memberLikeRepository.findByPerformerId(memberId);
// 좋아요한 멤버가 한 명 이상일 때만
if(!memberLikers.isEmpty()) {
List<Member> likers = memberLikers.stream()
.map(MemberLike::getLiker)
.collect(Collectors.toList());

eventPublisher.publishEvent(new NewShowEvent(newAmateurShow.getId(), memberId, likers)); //공연등록 이벤트 생성
}

// response
return AmateurConverter.toAmateurEnrollDTO(newAmateurShow);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public enum ErrorStatus implements BaseErrorCode {
AMATEUR_TICKET_NOT_FOUND(HttpStatus.NOT_FOUND, "AMATEURTICKET4000", "존재하지 않는 소극장 공연 티켓입니다."),
AMATEUR_TICKET_STOCK(HttpStatus.BAD_REQUEST, "AMATEURTICKET4001", "주문 수량은 최소 1개 이상이어야 합니다."),
AMATEUR_SHOW_MISMATCH(HttpStatus.NOT_FOUND, "AMATEURTICKET4002", "회차와 티켓에 해당하는 공연이 일치하지 않습니다."),

// PHOTOALBUM ERROR
PHOTOALBUM_NOT_FOUND(HttpStatus.NOT_FOUND, "PHOTOALBUM4000", "존재하지 않는 사진첩입니다."),

Expand All @@ -108,6 +109,7 @@ public enum ErrorStatus implements BaseErrorCode {

//NOTICE ERROR
MEMBERNOTICE_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBERNOTICE4001", "존재하지 않는 알림입니다."),
NOTICE_NOT_FOUND(HttpStatus.NOT_FOUND, "NOTICE4001", "존재하지 않는 알림입니다."),
Comment on lines 110 to +112
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n src/main/java/cc/backend/apiPayLoad/code/status/ErrorStatus.java | sed -n '100,120p'

Repository: SeeATheater/CC_Backend

Length of output: 1396


🏁 Script executed:

# Search for usages of these constants
rg "MEMBERNOTICE_NOT_FOUND|NOTICE_NOT_FOUND" -B 2 -A 2

Repository: SeeATheater/CC_Backend

Length of output: 1303


🏁 Script executed:

# Check for any comments or documentation about notice vs membernotice
rg -i "notice" src/main/java/cc/backend/apiPayLoad/code/status/ErrorStatus.java -B 1 -A 1 | head -50

Repository: SeeATheater/CC_Backend

Length of output: 270


🏁 Script executed:

# Search for all usages of NOTICE_NOT_FOUND more broadly
rg "NOTICE_NOT_FOUND" -r "Found in: $FILE"

Repository: SeeATheater/CC_Backend

Length of output: 498


🏁 Script executed:

# Check for Notice service/repository files
fd -t f "Notice" src/main/java --type f

Repository: SeeATheater/CC_Backend

Length of output: 953


🏁 Script executed:

# Look at the structure to find notice-related classes
fd -t d "notice" src/main/java

Repository: SeeATheater/CC_Backend

Length of output: 98


🏁 Script executed:

# Check NoticeService for how it handles not found cases
cat -n src/main/java/cc/backend/notice/service/NoticeService.java

Repository: SeeATheater/CC_Backend

Length of output: 933


🏁 Script executed:

# Check NoticeServiceImpl for how it handles not found cases
cat -n src/main/java/cc/backend/notice/service/NoticeServiceImpl.java

Repository: SeeATheater/CC_Backend

Length of output: 12662


🏁 Script executed:

# Check if there's a controller that might retrieve Notice directly
rg "noticeRepository\.findById|getNotice|Notice.*not.*found" -i -A 2 -B 2

Repository: SeeATheater/CC_Backend

Length of output: 10769


🏁 Script executed:

# Check MemberNoticeController to understand the API patterns
head -100 src/main/java/cc/backend/notice/controller/MemberNoticeController.java

Repository: SeeATheater/CC_Backend

Length of output: 2516


Remove unused NOTICE_NOT_FOUND error status.

NOTICE_NOT_FOUND is defined in ErrorStatus but never used anywhere in the codebase. Only MEMBERNOTICE_NOT_FOUND is actually used (in MemberNoticeService). The Notice entity is created through internal event handling in NoticeServiceImpl and is only accessed via MemberNotice relationships. Remove the unused constant or clarify if it should be used in a future feature.

🤖 Prompt for AI Agents
In `@src/main/java/cc/backend/apiPayLoad/code/status/ErrorStatus.java` around
lines 110 - 112, The enum constant NOTICE_NOT_FOUND in ErrorStatus is unused;
remove NOTICE_NOT_FOUND from ErrorStatus (leaving MEMBERNOTICE_NOT_FOUND intact)
unless you intend to use it later—if you do intend to keep it, update usages in
MemberNoticeService or NoticeServiceImpl to reference NOTICE_NOT_FOUND instead
of MEMBERNOTICE_NOT_FOUND; otherwise simply delete the NOTICE_NOT_FOUND enum
entry to eliminate dead code and redundant error codes.

// INQUIRY ERROR
INQUIRY_NOT_FOUND(HttpStatus.NOT_FOUND, "INQUIRY4000", "존재하지 않는 문의글입니다."),
FORBIDDEN_INQUIRY_ACCESS(HttpStatus.NOT_FOUND, "INQUIRY4001", "로그인한 멤버가 작성하지 않는 문의글입니다."),
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/cc/backend/board/service/BoardService.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
import cc.backend.board.entity.enums.BoardType;
import cc.backend.board.repository.BoardLikeRepository;
import cc.backend.board.repository.HotBoardRepository;
import cc.backend.event.entity.PromoteHotEvent;
import cc.backend.kafka.event.commentEvent.CommentProducer;
import cc.backend.kafka.event.hotBoardEvent.HotBoardEvent;
import cc.backend.image.DTO.ImageRequestDTO;
import cc.backend.image.DTO.ImageResponseDTO;
import cc.backend.image.FilePath;
import cc.backend.image.entity.Image;
import cc.backend.image.repository.ImageRepository;
import cc.backend.image.service.ImageService;
import cc.backend.kafka.event.hotBoardEvent.HotBoardProducer;
import cc.backend.kafka.event.replyEvent.ReplyProducer;
import cc.backend.member.entity.Member;
import cc.backend.board.repository.BoardRepository;
import cc.backend.member.enumerate.Role;
Expand Down Expand Up @@ -48,7 +51,7 @@ public class BoardService {
private final ImageService imageService;
private final ImageRepository imageRepository;

private final ApplicationEventPublisher eventPublisher;
private final HotBoardProducer hotBoardProducer;

// 게시글 작성
@Transactional
Expand Down Expand Up @@ -361,7 +364,8 @@ private void promoteToHotBoard(Board board) {
.build();
hotBoardRepository.save(hotBoard);

eventPublisher.publishEvent(new PromoteHotEvent(board.getId(), board.getMember().getId())); //핫게 이벤트 생성
//핫게 알림용 카프카 이벤트 생성
hotBoardProducer.publish(new HotBoardEvent(board.getId(), board.getMember().getId()));
}
}

Expand Down
27 changes: 22 additions & 5 deletions src/main/java/cc/backend/board/service/CommentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
import cc.backend.board.repository.BoardRepository;
import cc.backend.board.repository.CommentLikeRepository;
import cc.backend.board.repository.CommentRepository;
import cc.backend.event.entity.CommentEvent;
import cc.backend.event.entity.ReplyEvent;
import cc.backend.kafka.event.commentEvent.CommentEvent;
import cc.backend.kafka.event.commentEvent.CommentProducer;
import cc.backend.kafka.event.replyEvent.ReplyEvent;
import cc.backend.kafka.event.replyEvent.ReplyProducer;
import cc.backend.member.entity.Member;
import cc.backend.member.repository.MemberRepository;
import cc.backend.notice.event.CommentCommitEvent;
import cc.backend.notice.event.ReplyCommitEvent;
import cc.backend.notice.event.TicketReservationCommitEvent;
Comment on lines +20 to +22
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unused import TicketReservationCommitEvent.

This import is not used anywhere in CommentService.

Proposed fix
 import cc.backend.notice.event.CommentCommitEvent;
 import cc.backend.notice.event.ReplyCommitEvent;
-import cc.backend.notice.event.TicketReservationCommitEvent;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import cc.backend.notice.event.CommentCommitEvent;
import cc.backend.notice.event.ReplyCommitEvent;
import cc.backend.notice.event.TicketReservationCommitEvent;
import cc.backend.notice.event.CommentCommitEvent;
import cc.backend.notice.event.ReplyCommitEvent;
🤖 Prompt for AI Agents
In `@src/main/java/cc/backend/board/service/CommentService.java` around lines 20 -
22, Remove the unused import TicketReservationCommitEvent from the
CommentService.java imports; locate the import block in the CommentService class
(the lines that include cc.backend.notice.event.CommentCommitEvent,
ReplyCommitEvent, TicketReservationCommitEvent) and delete the
TicketReservationCommitEvent import so only used imports remain, then recompile
or run static checks to ensure no other references exist.

import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
Expand All @@ -32,7 +37,10 @@ public class CommentService {
private final BoardRepository boardRepository;
private final MemberRepository memberRepository;

private final ApplicationEventPublisher eventPublisher; //이벤트 생성자
private final CommentProducer commentProducer;
private final ReplyProducer replyProducer;
private final ApplicationEventPublisher eventPublisher;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, check if the file exists and get its basic info
wc -l src/main/java/cc/backend/board/service/CommentService.java

Repository: SeeATheater/CC_Backend

Length of output: 128


🏁 Script executed:

#!/bin/bash
# Verify CommentProducer and ReplyProducer are not used in CommentService
echo "=== Checking commentProducer usage ==="
rg -n 'commentProducer\.' src/main/java/cc/backend/board/service/CommentService.java || echo "No matches found"
echo ""
echo "=== Checking replyProducer usage ==="
rg -n 'replyProducer\.' src/main/java/cc/backend/board/service/CommentService.java || echo "No matches found"

Repository: SeeATheater/CC_Backend

Length of output: 176


🏁 Script executed:

#!/bin/bash
# Read the file to see field declarations and imports
echo "=== Lines 1-50 of CommentService.java ==="
sed -n '1,50p' src/main/java/cc/backend/board/service/CommentService.java

Repository: SeeATheater/CC_Backend

Length of output: 2324


🏁 Script executed:

#!/bin/bash
# Check if ReplyEvent and CommentEvent are used in the service
echo "=== Checking CommentEvent usage ==="
rg -n 'CommentEvent' src/main/java/cc/backend/board/service/CommentService.java || echo "No matches found"
echo ""
echo "=== Checking ReplyEvent usage ==="
rg -n 'ReplyEvent' src/main/java/cc/backend/board/service/CommentService.java || echo "No matches found"

Repository: SeeATheater/CC_Backend

Length of output: 252


🏁 Script executed:

#!/bin/bash
# Let's see more of the file to understand how these classes are used
echo "=== Lines 40-150 of CommentService.java ==="
sed -n '40,150p' src/main/java/cc/backend/board/service/CommentService.java

Repository: SeeATheater/CC_Backend

Length of output: 4789


🏁 Script executed:

#!/bin/bash
# Check for all usages of CommentEvent and ReplyEvent (excluding import statements)
echo "=== CommentEvent usages (excluding imports) ==="
rg -n 'CommentEvent' src/main/java/cc/backend/board/service/CommentService.java | grep -v '^[0-9]*:import'
echo ""
echo "=== ReplyEvent usages (excluding imports) ==="
rg -n 'ReplyEvent' src/main/java/cc/backend/board/service/CommentService.java | grep -v '^[0-9]*:import'

Repository: SeeATheater/CC_Backend

Length of output: 160


🏁 Script executed:

#!/bin/bash
# Let's check the entire file length and verify all imports
echo "=== First 30 lines to see all imports ==="
sed -n '1,30p' src/main/java/cc/backend/board/service/CommentService.java

Repository: SeeATheater/CC_Backend

Length of output: 1457


Remove unused CommentProducer, ReplyProducer, CommentEvent, and ReplyEvent dependencies.

These imports and field declarations are unused in this service. The service uses ApplicationEventPublisher to publish CommentCommitEvent and ReplyCommitEvent directly, which are then handled by listeners that consume the producers, not this service itself.

Proposed fix
-import cc.backend.kafka.event.commentEvent.CommentEvent;
-import cc.backend.kafka.event.commentEvent.CommentProducer;
-import cc.backend.kafka.event.replyEvent.ReplyEvent;
-import cc.backend.kafka.event.replyEvent.ReplyProducer;

And at lines 40-42:

-    private final CommentProducer commentProducer;
-    private final ReplyProducer replyProducer;
     private final ApplicationEventPublisher eventPublisher;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private final CommentProducer commentProducer;
private final ReplyProducer replyProducer;
private final ApplicationEventPublisher eventPublisher;
private final ApplicationEventPublisher eventPublisher;
🤖 Prompt for AI Agents
In `@src/main/java/cc/backend/board/service/CommentService.java` around lines 40 -
42, The CommentService class contains unused fields and imports for
CommentProducer, ReplyProducer, CommentEvent, and ReplyEvent; remove the
CommentProducer and ReplyProducer field declarations and any imports for
CommentEvent and ReplyEvent from the top of the file, leaving
ApplicationEventPublisher and the event types actually used (CommentCommitEvent,
ReplyCommitEvent) intact; ensure CommentService still publishes via
eventPublisher.publishEvent(...) and compile to verify no remaining references
to the removed symbols (CommentProducer, ReplyProducer, CommentEvent,
ReplyEvent) remain in the class or its imports.


//댓글 작성
@Transactional
public CommentCreateResponse createComment(Long boardId, Long memberId, CommentRequest req) {
Expand All @@ -47,7 +55,11 @@ public CommentCreateResponse createComment(Long boardId, Long memberId, CommentR
comment = Comment.createComment(req.getContent(), member, board);
commentRepository.save(comment);

eventPublisher.publishEvent(new CommentEvent(boardId, board.getMember().getId(), comment.getId(), comment.getMember().getId())); //댓글 이벤트 생성
//댓글 커밋 이벤트 생성
eventPublisher.publishEvent(
new CommentCommitEvent(boardId, board.getMember().getId(), comment.getId(), comment.getMember().getId())
);

} else {
// 대댓글
Comment parent = commentRepository.findById(req.getParentCommentId())
Expand All @@ -62,7 +74,12 @@ public CommentCreateResponse createComment(Long boardId, Long memberId, CommentR
comment = Comment.createReply(req.getContent(), member, board, parent);
commentRepository.save(comment);

eventPublisher.publishEvent(new ReplyEvent(parent.getId(), parent.getMember().getId(), comment.getId(), comment.getMember().getId())); //대댓글 이벤트 생성
//대댓글 커밋 이벤트 생성
eventPublisher.publishEvent(
new ReplyCommitEvent(parent.getId(), parent.getMember().getId(), comment.getId(), comment.getMember().getId())
);


}


Expand Down
16 changes: 0 additions & 16 deletions src/main/java/cc/backend/event/entity/ApproveShowEvent.java

This file was deleted.

19 changes: 0 additions & 19 deletions src/main/java/cc/backend/event/entity/CommentEvent.java

This file was deleted.

20 changes: 0 additions & 20 deletions src/main/java/cc/backend/event/entity/NewShowEvent.java

This file was deleted.

Loading