-
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 pull request #444 from mash-up-kr/feature/mashong-level-up
매숑이 레벨업 분리
- Loading branch information
Showing
9 changed files
with
117 additions
and
16 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
20 changes: 20 additions & 0 deletions
20
...-domain/src/main/java/kr/mashup/branding/service/mashong/PlatformMashongLevelService.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,20 @@ | ||
package kr.mashup.branding.service.mashong; | ||
|
||
import kr.mashup.branding.domain.ResultCode; | ||
import kr.mashup.branding.domain.exception.NotFoundException; | ||
import kr.mashup.branding.domain.mashong.PlatformMashongLevel; | ||
import kr.mashup.branding.repository.mashong.PlatformMashongLevelRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class PlatformMashongLevelService { | ||
|
||
private final PlatformMashongLevelRepository platformMashongLevelRepository; | ||
|
||
public PlatformMashongLevel findByLevel(int level) { | ||
return platformMashongLevelRepository.findByLevel(level) | ||
.orElseThrow(() -> new NotFoundException(ResultCode.PLATFORM_MASHONG_LEVEL_NOT_FOUND)); | ||
} | ||
} |
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
16 changes: 16 additions & 0 deletions
16
mashup-member/src/main/java/kr/mashup/branding/ui/mashong/request/MashongLevelUpRequest.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,16 @@ | ||
package kr.mashup.branding.ui.mashong.request; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import javax.validation.constraints.Min; | ||
import javax.validation.constraints.NotNull; | ||
|
||
@Getter | ||
public class MashongLevelUpRequest { | ||
|
||
@NotNull(message = "레벨업 목표 레벨은 비어있을 수 없습니다.") | ||
@Min(value = 1, message = "레벨업 목표 레벨은 1 이상이어야 합니다.") | ||
private int goalLevel; | ||
} |
22 changes: 22 additions & 0 deletions
22
...p-member/src/main/java/kr/mashup/branding/ui/mashong/response/MashongLevelUpResponse.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 kr.mashup.branding.ui.mashong.response; | ||
|
||
import kr.mashup.branding.domain.mashong.PlatformMashongLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@RequiredArgsConstructor | ||
public class MashongLevelUpResponse { | ||
|
||
private final int currentLevel; | ||
private final boolean isLevelUp; | ||
|
||
public static MashongLevelUpResponse of(boolean isLevelUp, PlatformMashongLevel level) { | ||
return MashongLevelUpResponse.builder() | ||
.isLevelUp(isLevelUp) | ||
.currentLevel(level.getLevel()) | ||
.build(); | ||
} | ||
} |