feat(community): 게시물 상세 응답 모델을 추가한다

This commit is contained in:
2026-07-07 11:55:33 +09:00
parent 19ada9e574
commit fe9adf35e7
4 changed files with 292 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
package kr.co.vividnext.sodalive.v2.api.creator.channel.community.dto
import com.fasterxml.jackson.annotation.JsonProperty
import kr.co.vividnext.sodalive.extensions.toUtcIso
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityComment
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityComments
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityPostDetail
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityReplies
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityReply
data class CreatorChannelCommunityPostDetailResponse(
val postId: Long,
val creatorId: Long,
val creatorNickname: String,
val creatorProfileUrl: String,
val createdAtUtc: String,
val content: String,
val imageUrl: String?,
val audioUrl: String?,
val price: Int,
@JsonProperty("isCommentAvailable")
val isCommentAvailable: Boolean,
val existOrdered: Boolean,
val likeCount: Int,
val commentCount: Int,
@JsonProperty("isPinned")
val isPinned: Boolean,
@JsonProperty("isLiked")
val isLiked: Boolean,
val comments: CreatorChannelCommunityCommentsResponse
) {
companion object {
fun from(detail: CreatorChannelCommunityPostDetail): CreatorChannelCommunityPostDetailResponse {
val post = detail.post
return CreatorChannelCommunityPostDetailResponse(
postId = post.postId,
creatorId = post.creatorId,
creatorNickname = post.creatorNickname,
creatorProfileUrl = post.creatorProfileUrl,
createdAtUtc = post.createdAt.toUtcIso(),
content = post.content,
imageUrl = post.imageUrl,
audioUrl = post.audioUrl,
price = post.price,
isCommentAvailable = post.isCommentAvailable,
existOrdered = post.existOrdered,
likeCount = post.likeCount,
commentCount = post.commentCount,
isPinned = post.isPinned,
isLiked = post.isLiked,
comments = CreatorChannelCommunityCommentsResponse.from(detail.comments)
)
}
}
}
data class CreatorChannelCommunityCommentsResponse(
val commentCount: Int,
val comments: List<CreatorChannelCommunityCommentResponse>,
val page: Int,
val size: Int,
@JsonProperty("hasNext")
val hasNext: Boolean
) {
companion object {
fun from(comments: CreatorChannelCommunityComments): CreatorChannelCommunityCommentsResponse {
return CreatorChannelCommunityCommentsResponse(
commentCount = comments.commentCount,
comments = comments.comments.map(CreatorChannelCommunityCommentResponse::from),
page = comments.page.page,
size = comments.page.size,
hasNext = comments.hasNext
)
}
}
}
data class CreatorChannelCommunityCommentResponse(
val commentId: Long,
val writerProfileImageUrl: String,
val writerNickname: String,
val content: String,
val createdAtUtc: String,
val latestReply: CreatorChannelCommunityReplyResponse?
) {
companion object {
fun from(comment: CreatorChannelCommunityComment): CreatorChannelCommunityCommentResponse {
return CreatorChannelCommunityCommentResponse(
commentId = comment.commentId,
writerProfileImageUrl = comment.writerProfileImageUrl,
writerNickname = comment.writerNickname,
content = comment.content,
createdAtUtc = comment.createdAt.toUtcIso(),
latestReply = comment.latestReply?.let(CreatorChannelCommunityReplyResponse::from)
)
}
}
}
data class CreatorChannelCommunityRepliesResponse(
val replyCount: Int,
val replies: List<CreatorChannelCommunityReplyResponse>,
val page: Int,
val size: Int,
@JsonProperty("hasNext")
val hasNext: Boolean
) {
companion object {
fun from(replies: CreatorChannelCommunityReplies): CreatorChannelCommunityRepliesResponse {
return CreatorChannelCommunityRepliesResponse(
replyCount = replies.replyCount,
replies = replies.replies.map(CreatorChannelCommunityReplyResponse::from),
page = replies.page.page,
size = replies.page.size,
hasNext = replies.hasNext
)
}
}
}
data class CreatorChannelCommunityReplyResponse(
val commentId: Long,
val writerProfileImageUrl: String,
val writerNickname: String,
val content: String,
val createdAtUtc: String
) {
companion object {
fun from(reply: CreatorChannelCommunityReply): CreatorChannelCommunityReplyResponse {
return CreatorChannelCommunityReplyResponse(
commentId = reply.commentId,
writerProfileImageUrl = reply.writerProfileImageUrl,
writerNickname = reply.writerNickname,
content = reply.content,
createdAtUtc = reply.createdAt.toUtcIso()
)
}
}
}

View File

@@ -0,0 +1,40 @@
package kr.co.vividnext.sodalive.v2.creator.channel.community.domain
import kr.co.vividnext.sodalive.v2.creator.channel.live.domain.CreatorChannelPage
import java.time.LocalDateTime
data class CreatorChannelCommunityPostDetail(
val post: CreatorChannelCommunityPost,
val comments: CreatorChannelCommunityComments
)
data class CreatorChannelCommunityComments(
val commentCount: Int,
val comments: List<CreatorChannelCommunityComment>,
val page: CreatorChannelPage,
val hasNext: Boolean
)
data class CreatorChannelCommunityComment(
val commentId: Long,
val writerProfileImageUrl: String,
val writerNickname: String,
val content: String,
val createdAt: LocalDateTime,
val latestReply: CreatorChannelCommunityReply?
)
data class CreatorChannelCommunityReplies(
val replyCount: Int,
val replies: List<CreatorChannelCommunityReply>,
val page: CreatorChannelPage,
val hasNext: Boolean
)
data class CreatorChannelCommunityReply(
val commentId: Long,
val writerProfileImageUrl: String,
val writerNickname: String,
val content: String,
val createdAt: LocalDateTime
)