-
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.
- Loading branch information
1 parent
5050c2c
commit d6173c5
Showing
6 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/main/java/com/dnd/runus/application/badge/BadgeEventHandler.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,18 @@ | ||
package com.dnd.runus.application.badge; | ||
|
||
import com.dnd.runus.application.member.event.SignupEvent; | ||
import com.dnd.runus.global.constant.BadgeType; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class BadgeEventHandler { | ||
private final BadgeService badgeService; | ||
|
||
@EventListener | ||
public void handleSignupEvent(SignupEvent signupEvent) { | ||
badgeService.achieveBadge(signupEvent.member(), BadgeType.PERSONAL_RECORD, 0); | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
src/main/java/com/dnd/runus/domain/badge/BadgeRepository.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,11 @@ | ||
package com.dnd.runus.domain.badge; | ||
|
||
import com.dnd.runus.global.constant.BadgeType; | ||
|
||
import java.util.List; | ||
|
||
public interface BadgeRepository { | ||
List<Badge> findByTypeAndRequiredValueLessThanEqual(BadgeType badgeType, int requiredValue); | ||
|
||
List<BadgeWithAchieveStatusAndAchievedAt> findAllBadgesWithAchieveStatusByMemberId(long memberId); | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/dnd/runus/infrastructure/persistence/jpa/badge/JpaBadgeRepository.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,11 @@ | ||
package com.dnd.runus.infrastructure.persistence.jpa.badge; | ||
|
||
import com.dnd.runus.global.constant.BadgeType; | ||
import com.dnd.runus.infrastructure.persistence.jpa.badge.entity.BadgeEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface JpaBadgeRepository extends JpaRepository<BadgeEntity, Long> { | ||
List<BadgeEntity> findByTypeAndRequiredValueLessThanEqual(BadgeType badgeType, int requiredValue); | ||
} |