오디션 배역 등 메시지 다국어 처리
This commit is contained in:
@@ -31,7 +31,7 @@ class AdminAuditionRoleService(
|
||||
auditionScriptUrl = request.auditionScriptUrl
|
||||
)
|
||||
val audition = auditionRepository.findByIdOrNull(id = request.auditionId)
|
||||
?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.")
|
||||
?: throw SodaException(messageKey = "admin.audition.invalid_request_retry")
|
||||
auditionRole.audition = audition
|
||||
repository.save(auditionRole)
|
||||
|
||||
@@ -48,15 +48,19 @@ class AdminAuditionRoleService(
|
||||
fun updateAuditionRole(image: MultipartFile?, requestString: String) {
|
||||
val request = objectMapper.readValue(requestString, UpdateAuditionRoleRequest::class.java)
|
||||
val auditionRole = repository.findByIdOrNull(id = request.id)
|
||||
?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.")
|
||||
?: throw SodaException(messageKey = "admin.audition.invalid_request_retry")
|
||||
|
||||
if (!request.name.isNullOrBlank()) {
|
||||
if (request.name.length < 2) throw SodaException("배역 이름은 최소 2글자 입니다")
|
||||
if (request.name.length < 2) {
|
||||
throw SodaException(messageKey = "admin.audition.role.name_min_length")
|
||||
}
|
||||
auditionRole.name = request.name
|
||||
}
|
||||
|
||||
if (!request.information.isNullOrBlank()) {
|
||||
if (request.information.length < 10) throw SodaException("오디션 배역 정보는 최소 10글자 입니다")
|
||||
if (request.information.length < 10) {
|
||||
throw SodaException(messageKey = "admin.audition.role.information_min_length")
|
||||
}
|
||||
auditionRole.information = request.information
|
||||
}
|
||||
|
||||
|
||||
@@ -10,19 +10,19 @@ data class CreateAuditionRoleRequest(
|
||||
) {
|
||||
init {
|
||||
if (auditionId < 0) {
|
||||
throw SodaException("캐릭터가 등록될 오디션을 선택하세요")
|
||||
throw SodaException(messageKey = "admin.audition.role.audition_required")
|
||||
}
|
||||
|
||||
if (name.isBlank() || name.length < 2) {
|
||||
throw SodaException("캐릭터명을 입력하세요")
|
||||
throw SodaException(messageKey = "admin.audition.role.name_required")
|
||||
}
|
||||
|
||||
if (auditionScriptUrl.isBlank() || auditionScriptUrl.length < 10) {
|
||||
throw SodaException("오디션 대본 URL을 입력하세요")
|
||||
throw SodaException(messageKey = "admin.audition.role.script_url_required")
|
||||
}
|
||||
|
||||
if (information.isBlank() || information.length < 10) {
|
||||
throw SodaException("오디션 캐릭터 정보는 최소 10글자 입니다")
|
||||
throw SodaException(messageKey = "admin.audition.role.information_required")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ data class UpdateAuditionRoleRequest(
|
||||
) {
|
||||
init {
|
||||
if (id < 0) {
|
||||
throw SodaException("잘못된 요청입니다.")
|
||||
throw SodaException(messageKey = "common.error.invalid_request")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ class CreatorSettlementRatioService(
|
||||
@Transactional
|
||||
fun createCreatorSettlementRatio(request: CreateCreatorSettlementRatioRequest) {
|
||||
val creator = memberRepository.findByIdOrNull(request.memberId)
|
||||
?: throw SodaException("잘못된 크리에이터 입니다.")
|
||||
?: throw SodaException(messageKey = "admin.settlement_ratio.invalid_creator")
|
||||
|
||||
if (creator.role != MemberRole.CREATOR) {
|
||||
throw SodaException("잘못된 크리에이터 입니다.")
|
||||
throw SodaException(messageKey = "admin.settlement_ratio.invalid_creator")
|
||||
}
|
||||
|
||||
val existing = repository.findByMemberId(request.memberId)
|
||||
@@ -43,12 +43,12 @@ class CreatorSettlementRatioService(
|
||||
@Transactional
|
||||
fun updateCreatorSettlementRatio(request: CreateCreatorSettlementRatioRequest) {
|
||||
val creator = memberRepository.findByIdOrNull(request.memberId)
|
||||
?: throw SodaException("잘못된 크리에이터 입니다.")
|
||||
?: throw SodaException(messageKey = "admin.settlement_ratio.invalid_creator")
|
||||
if (creator.role != MemberRole.CREATOR) {
|
||||
throw SodaException("잘못된 크리에이터 입니다.")
|
||||
throw SodaException(messageKey = "admin.settlement_ratio.invalid_creator")
|
||||
}
|
||||
val existing = repository.findByMemberId(request.memberId)
|
||||
?: throw SodaException("해당 크리에이터의 정산 비율 설정이 없습니다.")
|
||||
?: throw SodaException(messageKey = "admin.settlement_ratio.not_found")
|
||||
existing.restore()
|
||||
existing.updateValues(
|
||||
request.subsidy,
|
||||
@@ -62,7 +62,7 @@ class CreatorSettlementRatioService(
|
||||
@Transactional
|
||||
fun deleteCreatorSettlementRatio(memberId: Long) {
|
||||
val existing = repository.findByMemberId(memberId)
|
||||
?: throw SodaException("해당 크리에이터의 정산 비율 설정이 없습니다.")
|
||||
?: throw SodaException(messageKey = "admin.settlement_ratio.not_found")
|
||||
existing.softDelete()
|
||||
repository.save(existing)
|
||||
}
|
||||
|
||||
@@ -33,21 +33,21 @@ class AdminCanService(
|
||||
@Transactional
|
||||
fun deleteCan(id: Long) {
|
||||
val can = repository.findByIdOrNull(id)
|
||||
?: throw SodaException("잘못된 요청입니다.")
|
||||
?: throw SodaException(messageKey = "common.error.invalid_request")
|
||||
|
||||
can.status = CanStatus.END_OF_SALE
|
||||
}
|
||||
|
||||
@Transactional
|
||||
fun charge(request: AdminCanChargeRequest) {
|
||||
if (request.can <= 0) throw SodaException("1 캔 이상 입력하세요.")
|
||||
if (request.method.isBlank()) throw SodaException("기록내용을 입력하세요.")
|
||||
if (request.can <= 0) throw SodaException(messageKey = "admin.can.min_amount")
|
||||
if (request.method.isBlank()) throw SodaException(messageKey = "admin.can.method_required")
|
||||
|
||||
val ids = request.memberIds.distinct()
|
||||
if (ids.isEmpty()) throw SodaException("회원번호를 입력하세요.")
|
||||
if (ids.isEmpty()) throw SodaException(messageKey = "admin.can.member_ids_required")
|
||||
|
||||
val members = memberRepository.findAllById(ids).toList()
|
||||
if (members.size != ids.size) throw SodaException("잘못된 회원번호 입니다.")
|
||||
if (members.size != ids.size) throw SodaException(messageKey = "admin.can.invalid_member_ids")
|
||||
|
||||
members.forEach { member ->
|
||||
val charge = Charge(0, request.can, status = ChargeStatus.ADMIN)
|
||||
|
||||
Reference in New Issue
Block a user