-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: 상위 목표 d-day 기능 구현, 테스트 작성 (#6) - 상위 목표 종료 일자 필수 입력으로 확정 후, d-day 계산 로직 plan 엔티티내 생성 후 테스트 - planService에 상위 목표 단건 조회 로직 추가 * 간격 수정 * feat: 보상 제공 기능 구현 (#23) * feat: 상위 목표 달성 시 팝업 기능 구현 (#23) - 랜덤으로 보석 지급 기능 구현 - 상위 목표 리스트 조회 시 보석 enum도 조회 추가 - 보석 지급과 함께 complete 상태의 상위 목표 개수 조회 * test: 상위 목표 성공 시 기능 테스트 작성 (#23) * refactor: 상위 목표 개수 반환값 및 주석 수정
- Loading branch information
Showing
9 changed files
with
228 additions
and
29 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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/backend/detailgoal/application/RewardService.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,22 @@ | ||
package com.backend.detailgoal.application; | ||
|
||
import com.backend.goal.domain.RewardType; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Random; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class RewardService { | ||
|
||
private Random random = new Random(); | ||
private static final int NUM_GEM_TYPES = RewardType.values().length; | ||
|
||
public RewardType provideReward() | ||
{ | ||
int randomIndex = random.nextInt(NUM_GEM_TYPES); | ||
return RewardType.values()[randomIndex]; | ||
} | ||
|
||
} |
9 changes: 8 additions & 1 deletion
9
src/main/java/com/backend/detailgoal/application/dto/response/GoalCompletedResponse.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,4 +1,11 @@ | ||
package com.backend.detailgoal.application.dto.response; | ||
|
||
public record GoalCompletedResponse(Boolean isGoalCompleted) { | ||
import com.backend.goal.domain.RewardType; | ||
|
||
public record GoalCompletedResponse( | ||
Boolean isGoalCompleted, | ||
RewardType rewardType, | ||
Integer completedGoalCount | ||
|
||
) { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.backend.goal.domain; | ||
|
||
public enum RewardType { | ||
BLUE_JEWEL_1, | ||
BLUE_JEWEL_2, | ||
BLUE_JEWEL_3, | ||
BLUE_JEWEL_4, | ||
BLUE_JEWEL_5, | ||
PURPLE_JEWEL_1, | ||
PURPLE_JEWEL_2, | ||
PURPLE_JEWEL_3, | ||
PURPLE_JEWEL_4, | ||
PURPLE_JEWEL_5, | ||
PINK_JEWEL_1, | ||
PINK_JEWEL_2, | ||
PINK_JEWEL_3, | ||
PINK_JEWEL_4, | ||
PINK_JEWEL_5, | ||
GREEN_JEWEL_1, | ||
GREEN_JEWEL_2, | ||
GREEN_JEWEL_3, | ||
GREEN_JEWEL_4, | ||
GREEN_JEWEL_5; | ||
|
||
} |
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