Skip to content

Commit

Permalink
refactor: provideCoinByCompletePick yaml으로 이동, global하게 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
toychip committed Sep 21, 2024
1 parent 0f129f5 commit 98e7a64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ dojo:
size: 8
rank:
size: 3
coin:
solvedPick: 20
profile:
male: ENC(y7SDgKPyWwAg4dJMql9v7uWrAdJRQoMCHyPLxvma89kwZgpCKhva2Qi9Yfn7XBEyP6Z1hPVdfAJ4cuvcjoglQ1Obp3HtOc6+4+IXG7jttKCIA+sWpf9D3FagSvybbjN7BxgXrWIkloQ=)
female: ENC(G6ycXZSiw82d4TkZ8q5TOGbV/PnPW5TMvBPx6a0hojXGIm3c3Ho/K5FqNBhuKl/m2pSIPzK5ammRqCCKpFw6+S8YvjrmWumC/ky6ciXrIKAbriS45RwKNuprrpnT+zyVcdf0M8VXBnI=)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.mashup.dojo.service.CoinService
import com.mashup.dojo.service.MemberService
import com.mashup.dojo.service.PickService
import com.mashup.dojo.service.QuestionService
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Component
import org.springframework.transaction.annotation.Transactional

Expand Down Expand Up @@ -40,6 +41,8 @@ class DefaultCoinUseCase(
private val membersService: MemberService,
private val questionService: QuestionService,
private val pickService: PickService,
@Value("\${dojo.coin.solvedPick}")
private val provideCoinByCompletePick: Int,
) : CoinUseCase {
override fun getCurrentCoin(command: CoinUseCase.GetCurrentCoinCommand): Coin {
return coinService.getCoin(command.memberId) ?: throw DojoException.of(DojoExceptionType.NOT_EXIST, "유저의 코인정보가 없습니다")
Expand Down Expand Up @@ -71,7 +74,7 @@ class DefaultCoinUseCase(
questionSetId = operatingQSet.id
).size

return CoinUseCase.CoinBySolvedPick(solvedPickCount * PROVIDE_COIN_BY_COMPLETE_PICK)
return CoinUseCase.CoinBySolvedPick(solvedPickCount * provideCoinByCompletePick)
}

// todo 추후 Role을 넣어서 Security에서 관리하도록하면 좋을듯합니다.
Expand All @@ -98,8 +101,4 @@ class DefaultCoinUseCase(
return membersService.findByFullNameAndPlatform(fullName, platform)
}
}

companion object {
private const val PROVIDE_COIN_BY_COMPLETE_PICK = 20
}
}

0 comments on commit 98e7a64

Please sign in to comment.