클라이언트 메시지 다국어 처리

This commit is contained in:
2025-12-23 19:22:06 +09:00
parent e987a56544
commit 60e654cda9
11 changed files with 132 additions and 47 deletions

View File

@@ -26,7 +26,7 @@ class ContentSeriesController(private val service: ContentSeriesService) {
@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.getSeriesList(
@@ -49,7 +49,7 @@ class ContentSeriesController(private val service: ContentSeriesService) {
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@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.getSeriesDetail(
@@ -70,7 +70,7 @@ class ContentSeriesController(private val service: ContentSeriesService) {
@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.getSeriesContentList(
@@ -91,7 +91,7 @@ class ContentSeriesController(private val service: ContentSeriesService) {
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@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.getRecommendSeriesList(

View File

@@ -210,11 +210,11 @@ class ContentSeriesService(
seriesId = seriesId,
isAuth = member.auth != null && isAdultContentVisible,
contentType = contentType
) ?: throw SodaException("잘못된 시리즈 입니다.\n다시 시도해 주세요")
) ?: throw SodaException(messageKey = "series.error.invalid_series_retry")
val isBlocked = blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = series.member!!.id!!)
if (isBlocked) {
throw SodaException("잘못된 시리즈 입니다.\n다시 시도해 주세요")
throw SodaException(messageKey = "series.error.invalid_series_retry")
}
val creatorFollowing = explorerQueryRepository.getCreatorFollowing(

View File

@@ -31,7 +31,7 @@ class SeriesMainController(
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
val banners = bannerService.getActiveBanners(PageRequest.of(0, 10))
.content
@@ -70,7 +70,7 @@ class SeriesMainController(
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@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(
contentSeriesService.getRecommendSeriesList(
@@ -90,7 +90,7 @@ class SeriesMainController(
@RequestParam(defaultValue = "20") size: Int,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
val pageable = PageRequest.of(page, size)
ApiResponse.ok(
@@ -111,7 +111,7 @@ class SeriesMainController(
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
val memberId = member.id!!
val isAdult = member.auth != null && (isAdultContentVisible ?: true)
@@ -134,7 +134,7 @@ class SeriesMainController(
@RequestParam(defaultValue = "20") size: Int,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
val pageable = PageRequest.of(page, size)
ApiResponse.ok(

View File

@@ -18,13 +18,13 @@ class ContentSeriesBannerService(
fun getBannerById(bannerId: Long): SeriesBanner {
return bannerRepository.findById(bannerId)
.orElseThrow { SodaException("배너를 찾을 수 없습니다: $bannerId") }
.orElseThrow { SodaException(messageKey = "series.banner.error.not_found") }
}
@Transactional
fun registerBanner(seriesId: Long, imagePath: String): SeriesBanner {
val series = seriesRepository.findByIdAndActiveTrue(seriesId)
?: throw SodaException("시리즈를 찾을 수 없습니다: $seriesId")
?: throw SodaException(messageKey = "series.banner.error.series_not_found")
val finalSortOrder = (bannerRepository.findMaxSortOrder() ?: 0) + 1
@@ -43,14 +43,14 @@ class ContentSeriesBannerService(
seriesId: Long? = null
): SeriesBanner {
val banner = bannerRepository.findById(bannerId)
.orElseThrow { SodaException("배너를 찾을 수 없습니다: $bannerId") }
if (!banner.isActive) throw SodaException("비활성화된 배너는 수정할 수 없습니다: $bannerId")
.orElseThrow { SodaException(messageKey = "series.banner.error.not_found") }
if (!banner.isActive) throw SodaException(messageKey = "series.banner.error.inactive_cannot_update")
if (imagePath != null) banner.imagePath = imagePath
if (seriesId != null) {
val series = seriesRepository.findByIdAndActiveTrue(seriesId)
?: throw SodaException("시리즈를 찾을 수 없습니다: $seriesId")
?: throw SodaException(messageKey = "series.banner.error.series_not_found")
banner.series = series
}
@@ -60,7 +60,7 @@ class ContentSeriesBannerService(
@Transactional
fun deleteBanner(bannerId: Long) {
val banner = bannerRepository.findById(bannerId)
.orElseThrow { SodaException("배너를 찾을 수 없습니다: $bannerId") }
.orElseThrow { SodaException(messageKey = "series.banner.error.not_found") }
banner.isActive = false
bannerRepository.save(banner)
}
@@ -70,8 +70,8 @@ class ContentSeriesBannerService(
val updated = mutableListOf<SeriesBanner>()
for (index in ids.indices) {
val banner = bannerRepository.findById(ids[index])
.orElseThrow { SodaException("배너를 찾을 수 없습니다: ${ids[index]}") }
if (!banner.isActive) throw SodaException("비활성화된 배너는 수정할 수 없습니다: ${ids[index]}")
.orElseThrow { SodaException(messageKey = "series.banner.error.not_found") }
if (!banner.isActive) throw SodaException(messageKey = "series.banner.error.inactive_cannot_update")
banner.sortOrder = index + 1
updated.add(bannerRepository.save(banner))
}