-
This commit is contained in:
@@ -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,
|
||||
)
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user