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

공개 API 변경 없음.
This commit is contained in:
2025-12-22 23:12:29 +09:00
parent 93e0411337
commit 4dcf9f6ed1
11 changed files with 165 additions and 54 deletions

View File

@@ -11,8 +11,8 @@ import org.springframework.transaction.annotation.Transactional
class ServiceNoticeService(private val repository: ServiceServiceNoticeRepository) {
@Transactional
fun save(request: CreateNoticeRequest): Long {
if (request.title.isBlank()) throw SodaException("제목을 입력하세요.")
if (request.content.isBlank()) throw SodaException("내용을 입력하세요.")
if (request.title.isBlank()) throw SodaException(messageKey = "notice.error.title_required")
if (request.content.isBlank()) throw SodaException(messageKey = "notice.error.content_required")
val notice = request.toEntity()
return repository.save(notice).id!!
@@ -20,13 +20,13 @@ class ServiceNoticeService(private val repository: ServiceServiceNoticeRepositor
@Transactional
fun update(request: UpdateNoticeRequest) {
if (request.id <= 0) throw SodaException("잘못된 요청입니다.")
if (request.id <= 0) throw SodaException(messageKey = "common.error.invalid_request")
if (request.title.isNullOrBlank() && request.content.isNullOrBlank()) {
throw SodaException("수정할 내용을 입력하세요.")
throw SodaException(messageKey = "notice.error.update_required")
}
val notice = repository.findByIdOrNull(request.id)
?: throw SodaException("잘못된 요청입니다.")
?: throw SodaException(messageKey = "common.error.invalid_request")
if (!request.title.isNullOrBlank()) notice.title = request.title
if (!request.content.isNullOrBlank()) notice.content = request.content
@@ -34,9 +34,9 @@ class ServiceNoticeService(private val repository: ServiceServiceNoticeRepositor
@Transactional
fun delete(id: Long) {
if (id <= 0) throw SodaException("잘못된 요청입니다.")
if (id <= 0) throw SodaException(messageKey = "common.error.invalid_request")
val notice = repository.findByIdOrNull(id)
?: throw SodaException("잘못된 요청입니다.")
?: throw SodaException(messageKey = "common.error.invalid_request")
notice.isActive = false
}