✨ 공지사항 등록
This commit is contained in:
@@ -5,16 +5,16 @@ data class Notice(
|
||||
val content: String,
|
||||
) {
|
||||
data class Summary(
|
||||
val id: String,
|
||||
val id: String? = null,
|
||||
val title: String,
|
||||
val createdAt: String,
|
||||
val createdAt: String? = null,
|
||||
)
|
||||
|
||||
data class Detail(
|
||||
val id: String,
|
||||
val id: String? = null,
|
||||
val title: String,
|
||||
val content: String,
|
||||
val createdAt: String,
|
||||
val createdAt: String? = null,
|
||||
)
|
||||
|
||||
fun detail(): Detail {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package me.jiniworld.demohx.application.notice.port.input
|
||||
|
||||
data class RegisterNoticeCommand(
|
||||
val title: String,
|
||||
val content: String,
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
package me.jiniworld.demohx.application.notice.port.input
|
||||
|
||||
interface RegisterNoticeUseCase {
|
||||
suspend fun registerNotice(command: RegisterNoticeCommand)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package me.jiniworld.demohx.application.notice.port.output
|
||||
|
||||
import me.jiniworld.demohx.application.notice.domain.Notice
|
||||
|
||||
interface SaveNoticePort {
|
||||
suspend fun saveNotice(notice: Notice)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package me.jiniworld.demohx.application.notice.service
|
||||
|
||||
import me.jiniworld.demohx.annotation.UseCase
|
||||
import me.jiniworld.demohx.application.notice.domain.Notice
|
||||
import me.jiniworld.demohx.application.notice.port.input.RegisterNoticeCommand
|
||||
import me.jiniworld.demohx.application.notice.port.input.RegisterNoticeUseCase
|
||||
import me.jiniworld.demohx.application.notice.port.output.SaveNoticePort
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@UseCase
|
||||
internal class RegisterNoticeService(
|
||||
private val saveNoticePort: SaveNoticePort,
|
||||
): RegisterNoticeUseCase {
|
||||
|
||||
override suspend fun registerNotice(command: RegisterNoticeCommand) {
|
||||
saveNoticePort.saveNotice(Notice(Notice.Summary(title = command.title), content = command.content))
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user