-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 수강신청 철회 시 연관 엔티티도 같이 삭제하도록 변경 (#757)
* feat: 수강철회 시 이벤트 발행 * feat: 이벤트 핸들러 및 공통 스터디 서비스 로직 추가 * feat: 삭제 로직 구현 * docs: todo 추가
- Loading branch information
Showing
9 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/gdschongik/gdsc/domain/study/application/StudyEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.gdschongik.gdsc.domain.study.application; | ||
|
||
import com.gdschongik.gdsc.domain.study.domain.StudyApplyCanceledEvent; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.event.TransactionPhase; | ||
import org.springframework.transaction.event.TransactionalEventListener; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class StudyEventHandler { | ||
|
||
private final CommonStudyService commonStudyService; | ||
|
||
@TransactionalEventListener(phase = TransactionPhase.BEFORE_COMMIT) | ||
public void handleStudyApplyCanceledEvent(StudyApplyCanceledEvent event) { | ||
log.info("[StudyEventHandler] 스터디 수강신청 취소 이벤트 수신: studyHistoryId={}", event.studyHistoryId()); | ||
commonStudyService.deleteAttendanceByStudyHistory(event.studyHistoryId()); | ||
commonStudyService.deleteAssignmentHistoryByStudyHistory(event.studyHistoryId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyApplyCanceledEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.gdschongik.gdsc.domain.study.domain; | ||
|
||
public record StudyApplyCanceledEvent(Long studyHistoryId) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters