-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BSVR-253] Mixpanel Event Listener 사용하도록 리팩토링 (#186)
* refactor : 롤백, TODO 재정의 * feat : MixpanelEvent 구현 * refactor : MixpanelEventListener 사용 * refactor : MixpanelEvent 비즈니스 로직과 분리 * refactor : 불필요한 코드 제거 * refactor : MixpanelRepository 의존성 제거
- Loading branch information
1 parent
aa1fa16
commit 4a2442c
Showing
15 changed files
with
110 additions
and
60 deletions.
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
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
19 changes: 0 additions & 19 deletions
19
domain/src/main/java/org/depromeet/spot/domain/mixpanel/MixpanelEvent.java
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
usecase/src/main/java/org/depromeet/spot/usecase/port/in/review/like/ReviewLikeUsecase.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package org.depromeet.spot.usecase.port.in.review.like; | ||
|
||
public interface ReviewLikeUsecase { | ||
void toggleLike(Long memberId, long reviewId); | ||
boolean toggleLike(Long memberId, long reviewId); | ||
} |
4 changes: 2 additions & 2 deletions
4
usecase/src/main/java/org/depromeet/spot/usecase/port/out/mixpanel/MixpanelRepository.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package org.depromeet.spot.usecase.port.out.mixpanel; | ||
|
||
import org.depromeet.spot.domain.mixpanel.MixpanelEvent; | ||
import org.depromeet.spot.usecase.service.event.MixpanelEvent; | ||
|
||
public interface MixpanelRepository { | ||
void eventTrack(MixpanelEvent mixpanelEvent, String distinctId); | ||
void eventTrack(MixpanelEvent mixpanelEvent); | ||
} |
28 changes: 28 additions & 0 deletions
28
usecase/src/main/java/org/depromeet/spot/usecase/service/event/MixpanelEvent.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,28 @@ | ||
package org.depromeet.spot.usecase.service.event; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class MixpanelEvent { | ||
|
||
private final MixpanelEventName mixpanelEventName; | ||
|
||
private final String distinctId; | ||
|
||
@Getter | ||
public enum MixpanelEventName { | ||
REVIEW_REGISTER("review_register"), | ||
REVIEW_OPEN_COUNT("review_open_count"), | ||
REVIEW_LIKE_COUNT("review_like_count"), | ||
REVIEW_SCRAP_COUNT("review_scrap_count"), | ||
; | ||
|
||
String value; | ||
|
||
MixpanelEventName(String value) { | ||
this.value = value; | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
usecase/src/main/java/org/depromeet/spot/usecase/service/event/MixpanelEventListener.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,24 @@ | ||
package org.depromeet.spot.usecase.service.event; | ||
|
||
import org.depromeet.spot.usecase.port.out.mixpanel.MixpanelRepository; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class MixpanelEventListener { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(MixpanelEventListener.class); | ||
private final MixpanelRepository mixpanelRepository; | ||
|
||
@Async | ||
@EventListener | ||
public void eventTrack(MixpanelEvent mixpanelEvent) { | ||
mixpanelRepository.eventTrack(mixpanelEvent); | ||
} | ||
} |
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
Oops, something went wrong.