-
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.
Merge branch 'main' into feat/BSVR-249
- Loading branch information
Showing
18 changed files
with
135 additions
and
8 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
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: 19 additions & 0 deletions
19
domain/src/main/java/org/depromeet/spot/domain/mixpanel/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,19 @@ | ||
package org.depromeet.spot.domain.mixpanel; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum MixpanelEvent { | ||
REVIEW_REGISTER("review_register"), | ||
REVIEW_REGISTER_MAX("review_register"), | ||
REVIEW_OPEN_COUNT("review_open_count"), | ||
REVIEW_LIKE_COUNT("review_like_count"), | ||
REVIEW_SCRAP_COUNT("review_scrap_count"), | ||
; | ||
|
||
String value; | ||
|
||
MixpanelEvent(String value) { | ||
this.value = value; | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
...src/main/java/org/depromeet/spot/infrastructure/mixpanel/property/MixpanelProperties.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,6 @@ | ||
package org.depromeet.spot.infrastructure.mixpanel.property; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "mixpanel") | ||
public record MixpanelProperties(String token) {} |
48 changes: 48 additions & 0 deletions
48
...in/java/org/depromeet/spot/infrastructure/mixpanel/repository/MixpanelRepositoryImpl.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,48 @@ | ||
package org.depromeet.spot.infrastructure.mixpanel.repository; | ||
|
||
import java.io.IOException; | ||
|
||
import org.depromeet.spot.domain.mixpanel.MixpanelEvent; | ||
import org.depromeet.spot.infrastructure.mixpanel.property.MixpanelProperties; | ||
import org.depromeet.spot.usecase.port.out.mixpanel.MixpanelRepository; | ||
import org.json.JSONObject; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.mixpanel.mixpanelapi.ClientDelivery; | ||
import com.mixpanel.mixpanelapi.MessageBuilder; | ||
import com.mixpanel.mixpanelapi.MixpanelAPI; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class MixpanelRepositoryImpl implements MixpanelRepository { | ||
|
||
private final MixpanelProperties mixpanelProperties; | ||
|
||
// mixpanelEvent는 eventName(이 단위로 이벤트가 묶임) | ||
// distinctId는 사용자를 구분하는 데 사용됨. | ||
@Override | ||
public void eventTrack(MixpanelEvent mixpanelEvent, String distinctId) { | ||
try { | ||
|
||
// 믹스패널 이벤트 메시지 생성 | ||
MessageBuilder messageBuilder = new MessageBuilder(mixpanelProperties.token()); | ||
|
||
// 이벤트 생성 | ||
JSONObject sentEvent = messageBuilder.event(distinctId, mixpanelEvent.getValue(), null); | ||
|
||
// 만든 여러 이벤트를 delivery | ||
ClientDelivery delivery = new ClientDelivery(); | ||
delivery.addMessage(sentEvent); | ||
|
||
// Mixpanel로 데이터 전송 | ||
MixpanelAPI mixpanel = new MixpanelAPI(); | ||
mixpanel.deliver(delivery); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.depromeet.spot.usecase.port.out.mixpanel; | ||
|
||
import org.depromeet.spot.domain.mixpanel.MixpanelEvent; | ||
|
||
public interface MixpanelRepository { | ||
void eventTrack(MixpanelEvent mixpanelEvent, String distinctId); | ||
} |
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
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