diff --git a/core/demo-reactive-core/src/main/kotlin/me/jiniworld/demohx/application/notice/port/input/RegisterNoticeCommand.kt b/core/demo-reactive-core/src/main/kotlin/me/jiniworld/demohx/application/notice/port/input/RegisterNoticeCommand.kt index 4d3c977..252f163 100644 --- a/core/demo-reactive-core/src/main/kotlin/me/jiniworld/demohx/application/notice/port/input/RegisterNoticeCommand.kt +++ b/core/demo-reactive-core/src/main/kotlin/me/jiniworld/demohx/application/notice/port/input/RegisterNoticeCommand.kt @@ -1,6 +1,8 @@ package me.jiniworld.demohx.application.notice.port.input +import javax.validation.constraints.NotBlank + data class RegisterNoticeCommand( - val title: String, - val content: String, + @NotBlank val title: String, + @NotBlank val content: String, ) \ No newline at end of file diff --git a/core/demo-reactive-core/src/main/kotlin/me/jiniworld/demohx/application/notice/service/RegisterNoticeService.kt b/core/demo-reactive-core/src/main/kotlin/me/jiniworld/demohx/application/notice/service/RegisterNoticeService.kt index ee3b5ca..02a6c50 100644 --- a/core/demo-reactive-core/src/main/kotlin/me/jiniworld/demohx/application/notice/service/RegisterNoticeService.kt +++ b/core/demo-reactive-core/src/main/kotlin/me/jiniworld/demohx/application/notice/service/RegisterNoticeService.kt @@ -13,6 +13,7 @@ internal class RegisterNoticeService( private val saveNoticePort: SaveNoticePort, ): RegisterNoticeUseCase { + @Transactional override suspend fun registerNotice(command: RegisterNoticeCommand) { saveNoticePort.saveNotice(Notice(Notice.Summary(title = command.title), content = command.content)) } diff --git a/server/demo-reactive-app/src/main/kotlin/me/jiniworld/demohx/web/notice/RegisterNoticeController.kt b/server/demo-reactive-app/src/main/kotlin/me/jiniworld/demohx/web/notice/RegisterNoticeController.kt index f244015..960529b 100644 --- a/server/demo-reactive-app/src/main/kotlin/me/jiniworld/demohx/web/notice/RegisterNoticeController.kt +++ b/server/demo-reactive-app/src/main/kotlin/me/jiniworld/demohx/web/notice/RegisterNoticeController.kt @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController +import javax.validation.Valid @WebAdapter @Tag(name = "setting-system", description = "설정-시스템(공지사항, FAQ, 이용약관, 메타정보 등)") @@ -21,7 +22,7 @@ internal class RegisterNoticeController( @Operation(summary = "공지사항 등록") @PostMapping("") suspend fun getNotices( - @RequestBody command: RegisterNoticeCommand, + @Valid @RequestBody command: RegisterNoticeCommand, ) = registerNoticeUseCase.registerNotice(command) } \ No newline at end of file