feat(home-following): 팔로잉 탭 응답 모델을 추가한다
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
package kr.co.vividnext.sodalive.v2.api.home.following.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
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.HomeFollowingCreator
|
||||
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
|
||||
|
||||
data class HomeFollowingTabResponse(
|
||||
@JsonProperty("isLoginRequired")
|
||||
val isLoginRequired: Boolean,
|
||||
val followingCreators: List<FollowingCreatorResponse>,
|
||||
val onAirLives: List<FollowingLiveResponse>,
|
||||
val recentChats: List<ChatRoomListItemResponse>,
|
||||
val monthlySchedules: List<FollowingScheduleResponse>,
|
||||
val recentNews: List<FollowingNewsResponse>
|
||||
) {
|
||||
companion object {
|
||||
fun loginRequired(): HomeFollowingTabResponse {
|
||||
return HomeFollowingTabResponse(
|
||||
isLoginRequired = true,
|
||||
followingCreators = emptyList(),
|
||||
onAirLives = emptyList(),
|
||||
recentChats = emptyList(),
|
||||
monthlySchedules = emptyList(),
|
||||
recentNews = emptyList()
|
||||
)
|
||||
}
|
||||
|
||||
fun from(home: HomeFollowing): HomeFollowingTabResponse {
|
||||
return HomeFollowingTabResponse(
|
||||
isLoginRequired = false,
|
||||
followingCreators = home.followingCreators.map(FollowingCreatorResponse::from),
|
||||
onAirLives = home.onAirLives.map(FollowingLiveResponse::from),
|
||||
recentChats = home.recentChats,
|
||||
monthlySchedules = home.monthlySchedules.map(FollowingScheduleResponse::from),
|
||||
recentNews = home.recentNews.map(FollowingNewsResponse::from)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class FollowingCreatorResponse(
|
||||
val creatorId: Long,
|
||||
val creatorNickname: String,
|
||||
val creatorProfileImageUrl: String
|
||||
) {
|
||||
companion object {
|
||||
fun from(creator: HomeFollowingCreator): FollowingCreatorResponse {
|
||||
return FollowingCreatorResponse(
|
||||
creatorId = creator.creatorId,
|
||||
creatorNickname = creator.creatorNickname,
|
||||
creatorProfileImageUrl = creator.creatorProfileImageUrl
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class FollowingLiveResponse(
|
||||
val liveId: Long,
|
||||
val creatorProfileImageUrl: String,
|
||||
val creatorNickname: String,
|
||||
val title: String,
|
||||
val startedAtUtc: String
|
||||
) {
|
||||
companion object {
|
||||
fun from(live: HomeFollowingLive): FollowingLiveResponse {
|
||||
return FollowingLiveResponse(
|
||||
liveId = live.liveId,
|
||||
creatorProfileImageUrl = live.creatorProfileImageUrl,
|
||||
creatorNickname = live.creatorNickname,
|
||||
title = live.title,
|
||||
startedAtUtc = live.startedAtUtc
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class FollowingScheduleResponse(
|
||||
val scheduleId: String,
|
||||
val creatorId: Long,
|
||||
val creatorProfileImageUrl: String,
|
||||
val creatorNickname: String,
|
||||
val title: String,
|
||||
val type: CreatorActivityType,
|
||||
val targetId: Long,
|
||||
val scheduledAtUtc: String,
|
||||
@JsonProperty("isOnAir")
|
||||
val isOnAir: Boolean
|
||||
) {
|
||||
companion object {
|
||||
fun from(schedule: HomeFollowingSchedule): FollowingScheduleResponse {
|
||||
return FollowingScheduleResponse(
|
||||
scheduleId = schedule.scheduleId,
|
||||
creatorId = schedule.creatorId,
|
||||
creatorProfileImageUrl = schedule.creatorProfileImageUrl,
|
||||
creatorNickname = schedule.creatorNickname,
|
||||
title = schedule.title,
|
||||
type = schedule.type,
|
||||
targetId = schedule.targetId,
|
||||
scheduledAtUtc = schedule.scheduledAtUtc,
|
||||
isOnAir = schedule.isOnAir
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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?
|
||||
) {
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package kr.co.vividnext.sodalive.v2.home.following.domain
|
||||
|
||||
enum class FollowingNewsType {
|
||||
CREATOR_RANKING,
|
||||
CONTENT_RANKING,
|
||||
COMMUNITY_POST,
|
||||
AUDIO_CONTENT,
|
||||
PHOTO_CONTENT
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package kr.co.vividnext.sodalive.v2.home.following.domain
|
||||
|
||||
import kr.co.vividnext.sodalive.v2.chat.dto.ChatRoomListItemResponse
|
||||
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
||||
|
||||
data class HomeFollowing(
|
||||
val followingCreators: List<HomeFollowingCreator>,
|
||||
val onAirLives: List<HomeFollowingLive>,
|
||||
val recentChats: List<ChatRoomListItemResponse>,
|
||||
val monthlySchedules: List<HomeFollowingSchedule>,
|
||||
val recentNews: List<HomeFollowingNews>
|
||||
)
|
||||
|
||||
data class HomeFollowingCreator(
|
||||
val creatorId: Long,
|
||||
val creatorNickname: String,
|
||||
val creatorProfileImageUrl: String
|
||||
)
|
||||
|
||||
data class HomeFollowingLive(
|
||||
val liveId: Long,
|
||||
val creatorProfileImageUrl: String,
|
||||
val creatorNickname: String,
|
||||
val title: String,
|
||||
val startedAtUtc: String
|
||||
)
|
||||
|
||||
data class HomeFollowingSchedule(
|
||||
val scheduleId: String,
|
||||
val creatorId: Long,
|
||||
val creatorProfileImageUrl: String,
|
||||
val creatorNickname: String,
|
||||
val title: String,
|
||||
val type: CreatorActivityType,
|
||||
val targetId: Long,
|
||||
val scheduledAtUtc: String,
|
||||
val isOnAir: Boolean
|
||||
)
|
||||
|
||||
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?
|
||||
)
|
||||
Reference in New Issue
Block a user