refactor(creator-channel): CDN URL 변환 공통 함수를 사용한다
This commit is contained in:
@@ -7,6 +7,7 @@ import kr.co.vividnext.sodalive.member.Member
|
|||||||
import kr.co.vividnext.sodalive.member.MemberRole
|
import kr.co.vividnext.sodalive.member.MemberRole
|
||||||
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
||||||
import kr.co.vividnext.sodalive.member.contentpreference.isAdultVisibleByPolicy
|
import kr.co.vividnext.sodalive.member.contentpreference.isAdultVisibleByPolicy
|
||||||
|
import kr.co.vividnext.sodalive.v2.common.domain.toCdnUrl
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.audio.domain.CreatorChannelAudioQueryPolicy
|
import kr.co.vividnext.sodalive.v2.creator.channel.audio.domain.CreatorChannelAudioQueryPolicy
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.audio.domain.CreatorChannelAudioTab
|
import kr.co.vividnext.sodalive.v2.creator.channel.audio.domain.CreatorChannelAudioTab
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.audio.domain.CreatorChannelAudioTheme
|
import kr.co.vividnext.sodalive.v2.creator.channel.audio.domain.CreatorChannelAudioTheme
|
||||||
@@ -121,7 +122,7 @@ class CreatorChannelAudioQueryService(
|
|||||||
audioContentId = audioContentId,
|
audioContentId = audioContentId,
|
||||||
title = title,
|
title = title,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
imageUrl = imagePath.toCdnUrl(),
|
imageUrl = imagePath.toCdnUrl(cloudFrontHost),
|
||||||
price = price,
|
price = price,
|
||||||
isAdult = isAdult,
|
isAdult = isAdult,
|
||||||
isPointAvailable = isPointAvailable,
|
isPointAvailable = isPointAvailable,
|
||||||
@@ -131,10 +132,4 @@ class CreatorChannelAudioQueryService(
|
|||||||
isOwned = isOwned,
|
isOwned = isOwned,
|
||||||
isRented = isRented
|
isRented = isRented
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun String?.toCdnUrl(): String? {
|
|
||||||
if (isNullOrBlank()) return null
|
|
||||||
if (startsWith("https://") || startsWith("http://")) return this
|
|
||||||
return "$cloudFrontHost/$this"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import kr.co.vividnext.sodalive.member.Member
|
|||||||
import kr.co.vividnext.sodalive.member.MemberRole
|
import kr.co.vividnext.sodalive.member.MemberRole
|
||||||
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
||||||
import kr.co.vividnext.sodalive.member.contentpreference.isAdultVisibleByPolicy
|
import kr.co.vividnext.sodalive.member.contentpreference.isAdultVisibleByPolicy
|
||||||
|
import kr.co.vividnext.sodalive.v2.common.domain.toCdnUrl
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.common.domain.CreatorChannelAudioContent
|
import kr.co.vividnext.sodalive.v2.creator.channel.common.domain.CreatorChannelAudioContent
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelActivity
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelActivity
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCommunityPost
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCommunityPost
|
||||||
@@ -152,7 +153,7 @@ class CreatorChannelHomeQueryService(
|
|||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
characterId = characterId,
|
characterId = characterId,
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
profileImageUrl = profileImagePath.toCdnUrl() ?: defaultProfileImageUrl(),
|
profileImageUrl = profileImagePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(),
|
||||||
followerCount = followerCount,
|
followerCount = followerCount,
|
||||||
isAiChatAvailable = isAiChatAvailable,
|
isAiChatAvailable = isAiChatAvailable,
|
||||||
isDmAvailable = isDmAvailable,
|
isDmAvailable = isDmAvailable,
|
||||||
@@ -163,7 +164,7 @@ class CreatorChannelHomeQueryService(
|
|||||||
private fun CreatorChannelLiveRecord.toDomain() = CreatorChannelLive(
|
private fun CreatorChannelLiveRecord.toDomain() = CreatorChannelLive(
|
||||||
liveId = liveId,
|
liveId = liveId,
|
||||||
title = title,
|
title = title,
|
||||||
coverImageUrl = coverImagePath.toCdnUrl(),
|
coverImageUrl = coverImagePath.toCdnUrl(cloudFrontHost),
|
||||||
beginDateTime = beginDateTime,
|
beginDateTime = beginDateTime,
|
||||||
price = price,
|
price = price,
|
||||||
isAdult = isAdult
|
isAdult = isAdult
|
||||||
@@ -173,7 +174,7 @@ class CreatorChannelHomeQueryService(
|
|||||||
audioContentId = audioContentId,
|
audioContentId = audioContentId,
|
||||||
title = title,
|
title = title,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
imageUrl = imagePath.toCdnUrl(),
|
imageUrl = imagePath.toCdnUrl(cloudFrontHost),
|
||||||
price = price,
|
price = price,
|
||||||
isAdult = isAdult,
|
isAdult = isAdult,
|
||||||
isPointAvailable = isPointAvailable,
|
isPointAvailable = isPointAvailable,
|
||||||
@@ -186,7 +187,7 @@ class CreatorChannelHomeQueryService(
|
|||||||
|
|
||||||
private fun CreatorChannelDonationRecord.toDomain() = CreatorChannelDonation(
|
private fun CreatorChannelDonationRecord.toDomain() = CreatorChannelDonation(
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
profileImageUrl = profileImagePath.toCdnUrl() ?: defaultProfileImageUrl(),
|
profileImageUrl = profileImagePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(),
|
||||||
can = can,
|
can = can,
|
||||||
message = message,
|
message = message,
|
||||||
createdAt = createdAt
|
createdAt = createdAt
|
||||||
@@ -203,7 +204,7 @@ class CreatorChannelHomeQueryService(
|
|||||||
private fun CreatorChannelSeriesRecord.toDomain() = CreatorChannelSeries(
|
private fun CreatorChannelSeriesRecord.toDomain() = CreatorChannelSeries(
|
||||||
seriesId = seriesId,
|
seriesId = seriesId,
|
||||||
title = title,
|
title = title,
|
||||||
coverImageUrl = coverImagePath.toCdnUrl().orEmpty(),
|
coverImageUrl = coverImagePath.toCdnUrl(cloudFrontHost).orEmpty(),
|
||||||
numberOfContent = numberOfContent,
|
numberOfContent = numberOfContent,
|
||||||
isNew = isNew,
|
isNew = isNew,
|
||||||
isOriginal = isOriginal
|
isOriginal = isOriginal
|
||||||
@@ -213,9 +214,9 @@ class CreatorChannelHomeQueryService(
|
|||||||
postId = postId,
|
postId = postId,
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
creatorNickname = creatorNickname,
|
creatorNickname = creatorNickname,
|
||||||
creatorProfileUrl = creatorProfilePath.toCdnUrl() ?: defaultProfileImageUrl(),
|
creatorProfileUrl = creatorProfilePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(),
|
||||||
imageUrl = imagePath.toCdnUrl(),
|
imageUrl = imagePath.toCdnUrl(cloudFrontHost),
|
||||||
audioUrl = audioPath.toCdnUrl(),
|
audioUrl = audioPath.toCdnUrl(cloudFrontHost),
|
||||||
content = content,
|
content = content,
|
||||||
price = price,
|
price = price,
|
||||||
date = date,
|
date = date,
|
||||||
@@ -233,7 +234,7 @@ class CreatorChannelHomeQueryService(
|
|||||||
fanTalkId = fanTalkId,
|
fanTalkId = fanTalkId,
|
||||||
memberId = memberId,
|
memberId = memberId,
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
profileImageUrl = profileImagePath.toCdnUrl() ?: defaultProfileImageUrl(),
|
profileImageUrl = profileImagePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(),
|
||||||
content = content,
|
content = content,
|
||||||
languageCode = languageCode,
|
languageCode = languageCode,
|
||||||
createdAt = createdAt
|
createdAt = createdAt
|
||||||
@@ -257,11 +258,5 @@ class CreatorChannelHomeQueryService(
|
|||||||
kakaoOpenChatUrl = kakaoOpenChatUrl
|
kakaoOpenChatUrl = kakaoOpenChatUrl
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun String?.toCdnUrl(): String? {
|
|
||||||
if (isNullOrBlank()) return null
|
|
||||||
if (startsWith("https://") || startsWith("http://")) return this
|
|
||||||
return "$cloudFrontHost/$this"
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun defaultProfileImageUrl(): String = "$cloudFrontHost/profile/default-profile.png"
|
private fun defaultProfileImageUrl(): String = "$cloudFrontHost/profile/default-profile.png"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import kr.co.vividnext.sodalive.member.MemberRole
|
|||||||
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
||||||
import kr.co.vividnext.sodalive.member.contentpreference.isAdultVisibleByPolicy
|
import kr.co.vividnext.sodalive.member.contentpreference.isAdultVisibleByPolicy
|
||||||
import kr.co.vividnext.sodalive.v2.common.domain.ContentSort
|
import kr.co.vividnext.sodalive.v2.common.domain.ContentSort
|
||||||
|
import kr.co.vividnext.sodalive.v2.common.domain.toCdnUrl
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.common.domain.CreatorChannelAudioContent
|
import kr.co.vividnext.sodalive.v2.creator.channel.common.domain.CreatorChannelAudioContent
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.domain.CreatorChannelLive
|
import kr.co.vividnext.sodalive.v2.creator.channel.live.domain.CreatorChannelLive
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.domain.CreatorChannelLiveReplayQueryPolicy
|
import kr.co.vividnext.sodalive.v2.creator.channel.live.domain.CreatorChannelLiveReplayQueryPolicy
|
||||||
@@ -107,7 +108,7 @@ class CreatorChannelLiveQueryService(
|
|||||||
private fun CreatorChannelLiveRecord.toDomain() = CreatorChannelLive(
|
private fun CreatorChannelLiveRecord.toDomain() = CreatorChannelLive(
|
||||||
liveId = liveId,
|
liveId = liveId,
|
||||||
title = title,
|
title = title,
|
||||||
coverImageUrl = coverImagePath.toCdnUrl(),
|
coverImageUrl = coverImagePath.toCdnUrl(cloudFrontHost),
|
||||||
beginDateTime = beginDateTime,
|
beginDateTime = beginDateTime,
|
||||||
price = price,
|
price = price,
|
||||||
isAdult = isAdult
|
isAdult = isAdult
|
||||||
@@ -117,7 +118,7 @@ class CreatorChannelLiveQueryService(
|
|||||||
audioContentId = audioContentId,
|
audioContentId = audioContentId,
|
||||||
title = title,
|
title = title,
|
||||||
duration = duration,
|
duration = duration,
|
||||||
imageUrl = imagePath.toCdnUrl(),
|
imageUrl = imagePath.toCdnUrl(cloudFrontHost),
|
||||||
price = price,
|
price = price,
|
||||||
isAdult = isAdult,
|
isAdult = isAdult,
|
||||||
isPointAvailable = isPointAvailable,
|
isPointAvailable = isPointAvailable,
|
||||||
@@ -127,10 +128,4 @@ class CreatorChannelLiveQueryService(
|
|||||||
isOwned = isOwned,
|
isOwned = isOwned,
|
||||||
isRented = isRented
|
isRented = isRented
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun String?.toCdnUrl(): String? {
|
|
||||||
if (isNullOrBlank()) return null
|
|
||||||
if (startsWith("https://") || startsWith("http://")) return this
|
|
||||||
return "$cloudFrontHost/$this"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user