-
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package me.jiniworld.demohx.application.notice.port.input
|
package me.jiniworld.demohx.application.notice.port.input
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank
|
||||||
|
|
||||||
data class RegisterNoticeCommand(
|
data class RegisterNoticeCommand(
|
||||||
val title: String,
|
@NotBlank val title: String,
|
||||||
val content: String,
|
@NotBlank val content: String,
|
||||||
)
|
)
|
||||||
@@ -13,6 +13,7 @@ internal class RegisterNoticeService(
|
|||||||
private val saveNoticePort: SaveNoticePort,
|
private val saveNoticePort: SaveNoticePort,
|
||||||
): RegisterNoticeUseCase {
|
): RegisterNoticeUseCase {
|
||||||
|
|
||||||
|
@Transactional
|
||||||
override suspend fun registerNotice(command: RegisterNoticeCommand) {
|
override suspend fun registerNotice(command: RegisterNoticeCommand) {
|
||||||
saveNoticePort.saveNotice(Notice(Notice.Summary(title = command.title), content = command.content))
|
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.RequestBody
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.RequestMapping
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
|
import javax.validation.Valid
|
||||||
|
|
||||||
@WebAdapter
|
@WebAdapter
|
||||||
@Tag(name = "setting-system", description = "설정-시스템(공지사항, FAQ, 이용약관, 메타정보 등)")
|
@Tag(name = "setting-system", description = "설정-시스템(공지사항, FAQ, 이용약관, 메타정보 등)")
|
||||||
@@ -21,7 +22,7 @@ internal class RegisterNoticeController(
|
|||||||
@Operation(summary = "공지사항 등록")
|
@Operation(summary = "공지사항 등록")
|
||||||
@PostMapping("")
|
@PostMapping("")
|
||||||
suspend fun getNotices(
|
suspend fun getNotices(
|
||||||
@RequestBody command: RegisterNoticeCommand,
|
@Valid @RequestBody command: RegisterNoticeCommand,
|
||||||
) = registerNoticeUseCase.registerNotice(command)
|
) = registerNoticeUseCase.registerNotice(command)
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user