🎨 Notice domain에서 NoticeContent 분리
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package me.jiniworld.demohx.notice.adapter.out.persistence
|
||||
|
||||
import me.jiniworld.demohx.notice.domain.Notice
|
||||
import me.jiniworld.demohx.notice.domain.NoticeContent
|
||||
import org.springframework.data.annotation.CreatedDate
|
||||
import org.springframework.data.annotation.LastModifiedDate
|
||||
import java.time.LocalDateTime
|
||||
@@ -27,5 +28,5 @@ internal class NoticeEntity {
|
||||
var updatedAt: LocalDateTime? = null
|
||||
|
||||
fun mapToNotice() =
|
||||
Notice(id = id, title = title, content = content, createdAt = createdAt)
|
||||
Notice(id = id, noticeContent = NoticeContent(title = title, content = content), createdAt = createdAt)
|
||||
}
|
||||
|
||||
@@ -7,13 +7,12 @@ import java.time.LocalDateTime
|
||||
|
||||
data class Notice(
|
||||
val id: Long,
|
||||
val title: String,
|
||||
val content: String,
|
||||
val noticeContent: NoticeContent,
|
||||
val createdAt: LocalDateTime,
|
||||
) {
|
||||
fun mapToNoticeSimple() =
|
||||
NoticeSimple(id = id, title = title, createdOn = DateTimeUtils.toDateString(createdAt))
|
||||
NoticeSimple(id = id, title = noticeContent.title, createdOn = DateTimeUtils.toDateString(createdAt))
|
||||
|
||||
fun mapToNoticeDetail() =
|
||||
NoticeDetail(id = id, title = title, content = content, createdAt = DateTimeUtils.toString(createdAt))
|
||||
NoticeDetail(id = id, title = noticeContent.title, content = noticeContent.content, createdAt = DateTimeUtils.toString(createdAt))
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package me.jiniworld.demohx.notice.domain
|
||||
|
||||
data class NoticeContent(
|
||||
val title: String,
|
||||
val content: String,
|
||||
)
|
||||
Reference in New Issue
Block a user