feat(content): 콘텐츠 전체보기 응답 모델을 추가한다
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package kr.co.vividnext.sodalive.v2.api.content.overview.dto
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
import kr.co.vividnext.sodalive.v2.content.recommendation.domain.AudioCard
|
||||
import kr.co.vividnext.sodalive.v2.recommendation.port.out.HomeFirstAudioContentRecord
|
||||
|
||||
data class ContentOverviewPageResponse(
|
||||
val type: ContentOverviewType,
|
||||
val items: List<ContentOverviewItemResponse>,
|
||||
val page: Int,
|
||||
val size: Int,
|
||||
@JsonProperty("hasNext")
|
||||
val hasNext: Boolean
|
||||
)
|
||||
|
||||
enum class ContentOverviewType {
|
||||
NEW_AND_HOT_AUDIO,
|
||||
FIRST_AUDIO_CONTENT;
|
||||
|
||||
companion object {
|
||||
fun from(value: String?): ContentOverviewType {
|
||||
return values().firstOrNull { it.name == value } ?: NEW_AND_HOT_AUDIO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class ContentOverviewItemResponse(
|
||||
val contentId: Long,
|
||||
val title: String,
|
||||
val coverImage: String?,
|
||||
val price: Int,
|
||||
@JsonProperty("isPointAvailable")
|
||||
val isPointAvailable: Boolean,
|
||||
val creatorNickname: String,
|
||||
@JsonProperty("isAdult")
|
||||
val isAdult: Boolean,
|
||||
@JsonProperty("isFirstContent")
|
||||
val isFirstContent: Boolean,
|
||||
@JsonProperty("isOriginalSeries")
|
||||
val isOriginalSeries: Boolean
|
||||
) {
|
||||
companion object {
|
||||
fun fromNewAndHot(audio: AudioCard): ContentOverviewItemResponse {
|
||||
return ContentOverviewItemResponse(
|
||||
contentId = audio.audioContentId,
|
||||
title = audio.title,
|
||||
coverImage = audio.imageUrl,
|
||||
price = audio.price,
|
||||
isPointAvailable = audio.isPointAvailable,
|
||||
creatorNickname = audio.creatorNickname,
|
||||
isAdult = audio.isAdult,
|
||||
isFirstContent = audio.isFirstContent,
|
||||
isOriginalSeries = audio.isOriginalSeries
|
||||
)
|
||||
}
|
||||
|
||||
fun fromFirstAudioContent(
|
||||
audio: HomeFirstAudioContentRecord,
|
||||
coverImage: String?,
|
||||
isAdult: Boolean,
|
||||
isOriginalSeries: Boolean
|
||||
): ContentOverviewItemResponse {
|
||||
return ContentOverviewItemResponse(
|
||||
contentId = audio.contentId,
|
||||
title = audio.title,
|
||||
coverImage = coverImage,
|
||||
price = audio.price,
|
||||
isPointAvailable = audio.isPointAvailable,
|
||||
creatorNickname = audio.creatorNickname,
|
||||
isAdult = isAdult,
|
||||
isFirstContent = true,
|
||||
isOriginalSeries = isOriginalSeries
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user