feat(home): 팔로잉 최근 소식 응답을 중첩 구조로 바꾼다
This commit is contained in:
@@ -5,7 +5,11 @@ import kr.co.vividnext.sodalive.v2.chat.dto.ChatRoomListItemResponse
|
||||
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.FollowingNewsType
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowing
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowingCommunityPostNews
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowingContentNews
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowingContentRankingNews
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowingCreator
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowingCreatorRankingNews
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowingLive
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowingNews
|
||||
import kr.co.vividnext.sodalive.v2.home.following.domain.HomeFollowingSchedule
|
||||
@@ -112,31 +116,91 @@ data class FollowingScheduleResponse(
|
||||
data class FollowingNewsResponse(
|
||||
val newsId: String,
|
||||
val type: FollowingNewsType,
|
||||
val creatorProfileImageUrl: String,
|
||||
val creatorNickname: String,
|
||||
val title: String,
|
||||
val body: String,
|
||||
val thumbnailImageUrl: String?,
|
||||
val targetId: Long,
|
||||
val occurredAtUtc: String,
|
||||
val visibleFromAtUtc: String,
|
||||
val rank: Int?
|
||||
val creatorRanking: FollowingCreatorRankingNewsResponse?,
|
||||
val audioContent: FollowingContentNewsResponse?,
|
||||
val photoContent: FollowingContentNewsResponse?,
|
||||
val contentRanking: FollowingContentRankingNewsResponse?,
|
||||
val communityPost: FollowingCommunityPostNewsResponse?
|
||||
) {
|
||||
companion object {
|
||||
fun from(news: HomeFollowingNews): FollowingNewsResponse {
|
||||
return FollowingNewsResponse(
|
||||
newsId = news.newsId,
|
||||
type = news.type,
|
||||
creatorProfileImageUrl = news.creatorProfileImageUrl,
|
||||
creatorNickname = news.creatorNickname,
|
||||
title = news.title,
|
||||
body = news.body,
|
||||
thumbnailImageUrl = news.thumbnailImageUrl,
|
||||
targetId = news.targetId,
|
||||
occurredAtUtc = news.occurredAtUtc,
|
||||
visibleFromAtUtc = news.visibleFromAtUtc,
|
||||
rank = news.rank
|
||||
creatorRanking = news.creatorRanking?.toResponse(),
|
||||
audioContent = news.audioContent?.toContentResponse(),
|
||||
photoContent = news.photoContent?.toContentResponse(),
|
||||
contentRanking = news.contentRanking?.toResponse(),
|
||||
communityPost = news.communityPost?.toResponse()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class FollowingCreatorRankingNewsResponse(
|
||||
val rank: Int,
|
||||
val creatorId: Long,
|
||||
val nickname: String,
|
||||
val profileImageUrl: String
|
||||
)
|
||||
|
||||
data class FollowingContentNewsResponse(
|
||||
val contentId: Long,
|
||||
val contentImageUrl: String?,
|
||||
val title: String,
|
||||
val creatorProfileImageUrl: String,
|
||||
val creatorNickname: String
|
||||
)
|
||||
|
||||
data class FollowingContentRankingNewsResponse(
|
||||
val rank: Int,
|
||||
val contentId: Long,
|
||||
val contentImageUrl: String?,
|
||||
val title: String
|
||||
)
|
||||
|
||||
data class FollowingCommunityPostNewsResponse(
|
||||
val postId: Long,
|
||||
val creatorProfileImage: String,
|
||||
val creatorNickname: String,
|
||||
val imageUrl: String?,
|
||||
val content: String,
|
||||
val createdAt: String,
|
||||
val likeCount: Int,
|
||||
val commentCount: Int
|
||||
)
|
||||
|
||||
private fun HomeFollowingCreatorRankingNews.toResponse() = FollowingCreatorRankingNewsResponse(
|
||||
rank = rank,
|
||||
creatorId = creatorId,
|
||||
nickname = nickname,
|
||||
profileImageUrl = profileImageUrl
|
||||
)
|
||||
|
||||
private fun HomeFollowingContentNews.toContentResponse() = FollowingContentNewsResponse(
|
||||
contentId = contentId,
|
||||
contentImageUrl = contentImageUrl,
|
||||
title = title,
|
||||
creatorProfileImageUrl = creatorProfileImageUrl,
|
||||
creatorNickname = creatorNickname
|
||||
)
|
||||
|
||||
private fun HomeFollowingContentRankingNews.toResponse() = FollowingContentRankingNewsResponse(
|
||||
rank = rank,
|
||||
contentId = contentId,
|
||||
contentImageUrl = contentImageUrl,
|
||||
title = title
|
||||
)
|
||||
|
||||
private fun HomeFollowingCommunityPostNews.toResponse() = FollowingCommunityPostNewsResponse(
|
||||
postId = postId,
|
||||
creatorProfileImage = creatorProfileImage,
|
||||
creatorNickname = creatorNickname,
|
||||
imageUrl = imageUrl,
|
||||
content = content,
|
||||
createdAt = createdAt,
|
||||
likeCount = likeCount,
|
||||
commentCount = commentCount
|
||||
)
|
||||
|
||||
@@ -40,13 +40,43 @@ data class HomeFollowingSchedule(
|
||||
data class HomeFollowingNews(
|
||||
val newsId: String,
|
||||
val type: FollowingNewsType,
|
||||
val creatorProfileImageUrl: String,
|
||||
val creatorNickname: String,
|
||||
val title: String,
|
||||
val body: String,
|
||||
val thumbnailImageUrl: String?,
|
||||
val targetId: Long,
|
||||
val occurredAtUtc: String,
|
||||
val visibleFromAtUtc: String,
|
||||
val rank: Int?
|
||||
val creatorRanking: HomeFollowingCreatorRankingNews? = null,
|
||||
val audioContent: HomeFollowingContentNews? = null,
|
||||
val photoContent: HomeFollowingContentNews? = null,
|
||||
val contentRanking: HomeFollowingContentRankingNews? = null,
|
||||
val communityPost: HomeFollowingCommunityPostNews? = null
|
||||
)
|
||||
|
||||
data class HomeFollowingCreatorRankingNews(
|
||||
val rank: Int,
|
||||
val creatorId: Long,
|
||||
val nickname: String,
|
||||
val profileImageUrl: String
|
||||
)
|
||||
|
||||
data class HomeFollowingContentNews(
|
||||
val contentId: Long,
|
||||
val contentImageUrl: String?,
|
||||
val title: String,
|
||||
val creatorProfileImageUrl: String,
|
||||
val creatorNickname: String
|
||||
)
|
||||
|
||||
data class HomeFollowingContentRankingNews(
|
||||
val rank: Int,
|
||||
val contentId: Long,
|
||||
val contentImageUrl: String?,
|
||||
val title: String
|
||||
)
|
||||
|
||||
data class HomeFollowingCommunityPostNews(
|
||||
val postId: Long,
|
||||
val creatorProfileImage: String,
|
||||
val creatorNickname: String,
|
||||
val imageUrl: String?,
|
||||
val content: String,
|
||||
val createdAt: String,
|
||||
val likeCount: Int,
|
||||
val commentCount: Int
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user