diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/audio/application/CreatorChannelAudioQueryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/audio/application/CreatorChannelAudioQueryService.kt index 2807fead..e768b334 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/audio/application/CreatorChannelAudioQueryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/audio/application/CreatorChannelAudioQueryService.kt @@ -7,6 +7,7 @@ import kr.co.vividnext.sodalive.member.Member import kr.co.vividnext.sodalive.member.MemberRole import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService 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.CreatorChannelAudioTab import kr.co.vividnext.sodalive.v2.creator.channel.audio.domain.CreatorChannelAudioTheme @@ -121,7 +122,7 @@ class CreatorChannelAudioQueryService( audioContentId = audioContentId, title = title, duration = duration, - imageUrl = imagePath.toCdnUrl(), + imageUrl = imagePath.toCdnUrl(cloudFrontHost), price = price, isAdult = isAdult, isPointAvailable = isPointAvailable, @@ -131,10 +132,4 @@ class CreatorChannelAudioQueryService( isOwned = isOwned, isRented = isRented ) - - private fun String?.toCdnUrl(): String? { - if (isNullOrBlank()) return null - if (startsWith("https://") || startsWith("http://")) return this - return "$cloudFrontHost/$this" - } } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/home/application/CreatorChannelHomeQueryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/home/application/CreatorChannelHomeQueryService.kt index 4139fee9..4934c232 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/home/application/CreatorChannelHomeQueryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/home/application/CreatorChannelHomeQueryService.kt @@ -8,6 +8,7 @@ import kr.co.vividnext.sodalive.member.Member import kr.co.vividnext.sodalive.member.MemberRole import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService 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.home.domain.CreatorChannelActivity import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCommunityPost @@ -152,7 +153,7 @@ class CreatorChannelHomeQueryService( creatorId = creatorId, characterId = characterId, nickname = nickname, - profileImageUrl = profileImagePath.toCdnUrl() ?: defaultProfileImageUrl(), + profileImageUrl = profileImagePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(), followerCount = followerCount, isAiChatAvailable = isAiChatAvailable, isDmAvailable = isDmAvailable, @@ -163,7 +164,7 @@ class CreatorChannelHomeQueryService( private fun CreatorChannelLiveRecord.toDomain() = CreatorChannelLive( liveId = liveId, title = title, - coverImageUrl = coverImagePath.toCdnUrl(), + coverImageUrl = coverImagePath.toCdnUrl(cloudFrontHost), beginDateTime = beginDateTime, price = price, isAdult = isAdult @@ -173,7 +174,7 @@ class CreatorChannelHomeQueryService( audioContentId = audioContentId, title = title, duration = duration, - imageUrl = imagePath.toCdnUrl(), + imageUrl = imagePath.toCdnUrl(cloudFrontHost), price = price, isAdult = isAdult, isPointAvailable = isPointAvailable, @@ -186,7 +187,7 @@ class CreatorChannelHomeQueryService( private fun CreatorChannelDonationRecord.toDomain() = CreatorChannelDonation( nickname = nickname, - profileImageUrl = profileImagePath.toCdnUrl() ?: defaultProfileImageUrl(), + profileImageUrl = profileImagePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(), can = can, message = message, createdAt = createdAt @@ -203,7 +204,7 @@ class CreatorChannelHomeQueryService( private fun CreatorChannelSeriesRecord.toDomain() = CreatorChannelSeries( seriesId = seriesId, title = title, - coverImageUrl = coverImagePath.toCdnUrl().orEmpty(), + coverImageUrl = coverImagePath.toCdnUrl(cloudFrontHost).orEmpty(), numberOfContent = numberOfContent, isNew = isNew, isOriginal = isOriginal @@ -213,9 +214,9 @@ class CreatorChannelHomeQueryService( postId = postId, creatorId = creatorId, creatorNickname = creatorNickname, - creatorProfileUrl = creatorProfilePath.toCdnUrl() ?: defaultProfileImageUrl(), - imageUrl = imagePath.toCdnUrl(), - audioUrl = audioPath.toCdnUrl(), + creatorProfileUrl = creatorProfilePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(), + imageUrl = imagePath.toCdnUrl(cloudFrontHost), + audioUrl = audioPath.toCdnUrl(cloudFrontHost), content = content, price = price, date = date, @@ -233,7 +234,7 @@ class CreatorChannelHomeQueryService( fanTalkId = fanTalkId, memberId = memberId, nickname = nickname, - profileImageUrl = profileImagePath.toCdnUrl() ?: defaultProfileImageUrl(), + profileImageUrl = profileImagePath.toCdnUrl(cloudFrontHost) ?: defaultProfileImageUrl(), content = content, languageCode = languageCode, createdAt = createdAt @@ -257,11 +258,5 @@ class CreatorChannelHomeQueryService( 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" } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/live/application/CreatorChannelLiveQueryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/live/application/CreatorChannelLiveQueryService.kt index 5a57896f..07360f11 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/live/application/CreatorChannelLiveQueryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/live/application/CreatorChannelLiveQueryService.kt @@ -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.isAdultVisibleByPolicy 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.live.domain.CreatorChannelLive import kr.co.vividnext.sodalive.v2.creator.channel.live.domain.CreatorChannelLiveReplayQueryPolicy @@ -107,7 +108,7 @@ class CreatorChannelLiveQueryService( private fun CreatorChannelLiveRecord.toDomain() = CreatorChannelLive( liveId = liveId, title = title, - coverImageUrl = coverImagePath.toCdnUrl(), + coverImageUrl = coverImagePath.toCdnUrl(cloudFrontHost), beginDateTime = beginDateTime, price = price, isAdult = isAdult @@ -117,7 +118,7 @@ class CreatorChannelLiveQueryService( audioContentId = audioContentId, title = title, duration = duration, - imageUrl = imagePath.toCdnUrl(), + imageUrl = imagePath.toCdnUrl(cloudFrontHost), price = price, isAdult = isAdult, isPointAvailable = isPointAvailable, @@ -127,10 +128,4 @@ class CreatorChannelLiveQueryService( isOwned = isOwned, isRented = isRented ) - - private fun String?.toCdnUrl(): String? { - if (isNullOrBlank()) return null - if (startsWith("https://") || startsWith("http://")) return this - return "$cloudFrontHost/$this" - } }