Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 야구게임 베팅가능 금액 변경 #446

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.springframework.transaction.annotation.Transactional
const val REDIS_KEY_PREFIX = "baseball_"
const val GUESS_NUMBER_LENGTH = 4
const val TRY_COUNT = 9
const val MAX_BETTING_POINT = 5000L
const val MAX_BETTING_POINT = 3000L
const val MIN_BETTING_POINT = 1000L
const val BETTING_POINT_MESSAGE = "야구 게임 베팅"
const val EARN_POINT_MESSAGE = "야구 게임 획득"
Expand Down Expand Up @@ -66,6 +66,10 @@ class BaseballService(
if (bettingPoint <= 0) {
throw BusinessException(requestMember.id, "memberId", ErrorCode.POINT_MUST_BE_POSITIVE)
}
if (bettingPoint !in 1000..3000) {
yeochaeeon marked this conversation as resolved.
Show resolved Hide resolved
throw BusinessException(requestMember.id, "memberId", ErrorCode.INVALID_BETTING_POINT)
}

if (requestMember.point < bettingPoint) {
throw BusinessException(requestMember.id, "memberId", ErrorCode.NOT_ENOUGH_POINT)
}
Expand Down Expand Up @@ -130,6 +134,7 @@ class BaseballService(
val earnablePoint = baseballResultEntity.earnablePoint

if (baseballResultEntity.isEnd()) {
earnablePoint * 2
requestMember.addPoint(earnablePoint, EARN_POINT_MESSAGE)
gameEntity.baseball.baseballDayPoint = earnablePoint
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public enum ErrorCode {
NOT_ENOUGH_POINT("베팅 포인트는 보유한 포인트보다 많을 수 없습니다.", HttpStatus.BAD_REQUEST),
POINT_MUST_BE_POSITIVE("베팅 포인트는 양수여야 합니다.", HttpStatus.BAD_REQUEST),
NOT_PLAYED_YET("아직 게임을 시작하지 않았습니다.", HttpStatus.BAD_REQUEST),
INVALID_BETTING_POINT("베팅포인트는 1000이상 3000이하의 숫자여야합니다",HttpStatus.BAD_REQUEST),
yeochaeeon marked this conversation as resolved.
Show resolved Hide resolved
// FILE
FILE_NOT_FOUND("해당 파일은 존재하지 않습니다.", HttpStatus.BAD_REQUEST),
// ATTENDANCE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class GameControllerTest : GameApiTestHelper() {
.andExpect(status().isOk)
.andExpect(jsonPath("$.guessNumberLength").value(4))
.andExpect(jsonPath("$.tryCount").value(9))
.andExpect(jsonPath("$.maxBettingPoint").value(5000L))
.andExpect(jsonPath("$.maxBettingPoint").value(3000L))
.andExpect(jsonPath("$.minBettingPoint").value(1000L))
.andDo(
document(
Expand Down
Loading