Skip to content

Commit

Permalink
feat: #1 validation 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
chs98412 committed Jun 15, 2024
1 parent 4dd1444 commit f61b8a7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation("org.springframework.boot:spring-boot-starter-validation")
}

tasks.withType<KotlinCompile> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import org.slf4j.LoggerFactory
import kotlin.coroutines.AbstractCoroutineContextElement
import kotlin.coroutines.CoroutineContext

object GlobalCoroutineExceptionHandler: AbstractCoroutineContextElement(CoroutineExceptionHandler),
CoroutineExceptionHandler{
private val log = LoggerFactory.getLogger(javaClass)
object GlobalCoroutineExceptionHandler : AbstractCoroutineContextElement(CoroutineExceptionHandler),
CoroutineExceptionHandler {
private val log = LoggerFactory.getLogger(javaClass)

override fun handleException(context: CoroutineContext, exception: Throwable) {
val name = context[CoroutineName]?.name ?: "coroutuine"
val description=context[CoroutineDescription]?.description
log.error("$name failed. : $description", exception)
for (suppressed in exception.suppressed) {
log.error("$name has suppressed error",suppressed)
}
override fun handleException(context: CoroutineContext, exception: Throwable) {
val name = context[CoroutineName]?.name ?: "coroutine"
val description = context[CoroutineDescription]?.description
log.error("$name failed. : $description", exception)
for (suppressed in exception.suppressed) {
log.error("$name has suppressed error", suppressed)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.soon.common.presentation.handler.model

import com.soon.common.application.model.ItemCreateCommand
import jakarta.validation.constraints.NotBlank

data class ItemCreateRequest(
@field:NotBlank
val title: String,
@field:NotBlank
val description: String,
@field:NotBlank
val thumbnail: String,
) {
fun toCommand(serviceNo: Int) = ItemCreateCommand(
Expand Down
2 changes: 1 addition & 1 deletion src/test/http/common-game.http
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Content-Type: application/json
Service-Code:eyJubyI6MSwidGl0bGUiOiJ0aXRsZSJ9

{
"title": "title",
"title": "fdghjkgfhjgfhjgfhjg",
"description": "description",
"thumbnail": "thumbnail"
}
Expand Down

0 comments on commit f61b8a7

Please sign in to comment.