알림/오디션 메시지 다국어 분리
알림/오디션 오류 응답 메시지를 키 기반 다국어로 분리
This commit is contained in:
@@ -32,7 +32,7 @@ class AuditionController(private val service: AuditionService) {
|
||||
@PathVariable id: Long,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||
|
||||
ApiResponse.ok(service.getAuditionDetail(auditionId = id))
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class AuditionApplicantController(private val service: AuditionApplicantService)
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
pageable: Pageable
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.getAuditionApplicantList(
|
||||
@@ -42,7 +42,7 @@ class AuditionApplicantController(private val service: AuditionApplicantService)
|
||||
@RequestPart("request") requestString: String,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.applyAuditionRole(
|
||||
|
||||
@@ -47,11 +47,11 @@ class AuditionApplicantService(
|
||||
|
||||
@Transactional
|
||||
fun applyAuditionRole(contentFile: MultipartFile?, requestString: String, member: Member) {
|
||||
if (contentFile == null) throw SodaException("녹음 파일을 확인해 주세요.")
|
||||
if (contentFile == null) throw SodaException(messageKey = "audition.applicant.content_file_required")
|
||||
val request = objectMapper.readValue(requestString, ApplyAuditionRoleRequest::class.java)
|
||||
|
||||
val auditionRole = roleRepository.findByIdOrNull(id = request.roleId)
|
||||
?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.")
|
||||
?: throw SodaException(messageKey = "audition.error.invalid_request_retry")
|
||||
|
||||
val existingApplicant = repository.findActiveApplicantByMemberIdAndRoleId(
|
||||
memberId = member.id!!,
|
||||
|
||||
@@ -17,7 +17,7 @@ class AuditionRoleController(private val service: AuditionRoleService) {
|
||||
@PathVariable id: Long,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.getAuditionRoleDetail(
|
||||
|
||||
@@ -11,7 +11,7 @@ class AuditionRoleService(
|
||||
) {
|
||||
fun getAuditionRoleDetail(auditionRoleId: Long, memberId: Long): GetAuditionRoleDetailResponse {
|
||||
val roleDetailData = repository.getAuditionRoleDetail(auditionRoleId = auditionRoleId)
|
||||
?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.")
|
||||
?: throw SodaException(messageKey = "audition.error.invalid_request_retry")
|
||||
|
||||
val isAlreadyApplicant = applicantRepository.isAlreadyApplicant(
|
||||
auditionRoleId = auditionRoleId,
|
||||
|
||||
@@ -19,7 +19,7 @@ class AuditionVoteController(
|
||||
@RequestBody request: VoteAuditionApplicantRequest,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.voteAuditionApplicant(
|
||||
|
||||
@@ -20,7 +20,7 @@ class AuditionVoteService(
|
||||
) {
|
||||
fun voteAuditionApplicant(applicantId: Long, timezone: String, container: String, member: Member) {
|
||||
val applicant = applicantRepository.findByIdOrNull(applicantId)
|
||||
?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.")
|
||||
?: throw SodaException(messageKey = "audition.error.invalid_request_retry")
|
||||
|
||||
val defaultZoneId = ZoneId.of("Asia/Seoul")
|
||||
val clientZoneId = try {
|
||||
@@ -43,7 +43,7 @@ class AuditionVoteService(
|
||||
)
|
||||
|
||||
if (voteCount > 100) {
|
||||
throw SodaException("오늘 응원은 여기까지!\n하루 최대 100회까지 응원이 가능합니다.\n내일 다시 이용해주세요.")
|
||||
throw SodaException(messageKey = "audition.vote.max_daily_reached")
|
||||
}
|
||||
|
||||
if (voteCount > 0) {
|
||||
|
||||
Reference in New Issue
Block a user