test(creator-channel): 홈 커뮤니티 서비스 연결을 검증한다
This commit is contained in:
@@ -10,8 +10,8 @@ import kr.co.vividnext.sodalive.v2.api.creator.channel.home.application.CreatorC
|
|||||||
import kr.co.vividnext.sodalive.v2.api.creator.channel.home.dto.CreatorChannelHomeResponse
|
import kr.co.vividnext.sodalive.v2.api.creator.channel.home.dto.CreatorChannelHomeResponse
|
||||||
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
||||||
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.community.domain.CreatorChannelCommunityPost
|
||||||
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.CreatorChannelCreator
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCreator
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelDonation
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelDonation
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelFanTalk
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelFanTalk
|
||||||
@@ -132,6 +132,9 @@ class CreatorChannelHomeControllerTest @Autowired constructor(
|
|||||||
.andExpect(jsonPath("$.data.channelDonations[0].donationId").doesNotExist())
|
.andExpect(jsonPath("$.data.channelDonations[0].donationId").doesNotExist())
|
||||||
.andExpect(jsonPath("$.data.channelDonations[0].memberId").doesNotExist())
|
.andExpect(jsonPath("$.data.channelDonations[0].memberId").doesNotExist())
|
||||||
.andExpect(jsonPath("$.data.channelDonations[0].isSecret").doesNotExist())
|
.andExpect(jsonPath("$.data.channelDonations[0].isSecret").doesNotExist())
|
||||||
|
.andExpect(jsonPath("$.data.notices[0].dateUtc").value("2026-06-12T04:00:00Z"))
|
||||||
|
.andExpect(jsonPath("$.data.notices[0].imageUrl").doesNotExist())
|
||||||
|
.andExpect(jsonPath("$.data.notices[0].audioUrl").doesNotExist())
|
||||||
.andExpect(jsonPath("$.data.series[0].isNew").value(true))
|
.andExpect(jsonPath("$.data.series[0].isNew").value(true))
|
||||||
.andExpect(jsonPath("$.data.series[0].isOriginal").value(true))
|
.andExpect(jsonPath("$.data.series[0].isOriginal").value(true))
|
||||||
|
|
||||||
@@ -159,14 +162,16 @@ class CreatorChannelHomeControllerTest @Autowired constructor(
|
|||||||
creatorId = 1L,
|
creatorId = 1L,
|
||||||
creatorNickname = "creator",
|
creatorNickname = "creator",
|
||||||
creatorProfileUrl = "profile.png",
|
creatorProfileUrl = "profile.png",
|
||||||
imageUrl = "image.png",
|
imageUrl = null,
|
||||||
audioUrl = "audio.mp3",
|
audioUrl = null,
|
||||||
content = "notice",
|
content = "notice",
|
||||||
price = 10,
|
price = 10,
|
||||||
date = LocalDateTime.of(2026, 6, 12, 4, 0),
|
createdAt = LocalDateTime.of(2026, 6, 12, 4, 0),
|
||||||
existOrdered = true,
|
existOrdered = true,
|
||||||
|
isCommentAvailable = true,
|
||||||
likeCount = 2,
|
likeCount = 2,
|
||||||
commentCount = 3
|
commentCount = 3,
|
||||||
|
isPinned = true
|
||||||
)
|
)
|
||||||
|
|
||||||
return CreatorChannelHome(
|
return CreatorChannelHome(
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ 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.v2.common.domain.CreatorActivityType
|
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
||||||
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.community.domain.CreatorChannelCommunityPost
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.application.CreatorChannelHomeQueryService
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.application.CreatorChannelHomeQueryService
|
||||||
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.CreatorChannelCreator
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCreator
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelDonation
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelDonation
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelFanTalk
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelFanTalk
|
||||||
@@ -18,6 +18,7 @@ import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelSer
|
|||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelSns
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelSns
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.Assertions.assertFalse
|
import org.junit.jupiter.api.Assertions.assertFalse
|
||||||
|
import org.junit.jupiter.api.Assertions.assertNull
|
||||||
import org.junit.jupiter.api.Assertions.assertTrue
|
import org.junit.jupiter.api.Assertions.assertTrue
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
@@ -58,6 +59,8 @@ class CreatorChannelHomeFacadeTest {
|
|||||||
assertFalse(response.latestAudioContent?.isRented == true)
|
assertFalse(response.latestAudioContent?.isRented == true)
|
||||||
assertEquals("thanks", response.channelDonations.first().message)
|
assertEquals("thanks", response.channelDonations.first().message)
|
||||||
assertEquals(301L, response.notices.first().postId)
|
assertEquals(301L, response.notices.first().postId)
|
||||||
|
assertEquals("2026-06-12T04:00:00Z", response.notices.first().dateUtc)
|
||||||
|
assertNull(response.notices.first().imageUrl)
|
||||||
assertEquals(501L, response.schedules.first().targetId)
|
assertEquals(501L, response.schedules.first().targetId)
|
||||||
assertEquals(202L, response.audioContents.first().audioContentId)
|
assertEquals(202L, response.audioContents.first().audioContentId)
|
||||||
assertFalse(response.audioContents.first().isOwned)
|
assertFalse(response.audioContents.first().isOwned)
|
||||||
@@ -89,14 +92,16 @@ class CreatorChannelHomeFacadeTest {
|
|||||||
creatorId = 1L,
|
creatorId = 1L,
|
||||||
creatorNickname = "creator",
|
creatorNickname = "creator",
|
||||||
creatorProfileUrl = "profile.png",
|
creatorProfileUrl = "profile.png",
|
||||||
imageUrl = "image.png",
|
imageUrl = null,
|
||||||
audioUrl = "audio.mp3",
|
audioUrl = null,
|
||||||
content = "notice",
|
content = "notice",
|
||||||
price = 10,
|
price = 10,
|
||||||
date = LocalDateTime.of(2026, 6, 12, 4, 0),
|
createdAt = LocalDateTime.of(2026, 6, 12, 4, 0),
|
||||||
existOrdered = true,
|
existOrdered = true,
|
||||||
|
isCommentAvailable = true,
|
||||||
likeCount = 2,
|
likeCount = 2,
|
||||||
commentCount = 3
|
commentCount = 3,
|
||||||
|
isPinned = true
|
||||||
)
|
)
|
||||||
|
|
||||||
return CreatorChannelHome(
|
return CreatorChannelHome(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package kr.co.vividnext.sodalive.v2.creator.channel.home.application
|
package kr.co.vividnext.sodalive.v2.creator.channel.home.application
|
||||||
|
|
||||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
|
import kr.co.vividnext.sodalive.aws.cloudfront.AudioContentCloudFront
|
||||||
import kr.co.vividnext.sodalive.common.SodaException
|
import kr.co.vividnext.sodalive.common.SodaException
|
||||||
import kr.co.vividnext.sodalive.content.ContentType
|
import kr.co.vividnext.sodalive.content.ContentType
|
||||||
import kr.co.vividnext.sodalive.i18n.Lang
|
import kr.co.vividnext.sodalive.i18n.Lang
|
||||||
@@ -16,8 +17,13 @@ import kr.co.vividnext.sodalive.member.contentpreference.ViewerContentPreference
|
|||||||
import kr.co.vividnext.sodalive.v2.api.creator.channel.home.dto.CreatorChannelHomeResponse
|
import kr.co.vividnext.sodalive.v2.api.creator.channel.home.dto.CreatorChannelHomeResponse
|
||||||
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
import kr.co.vividnext.sodalive.v2.common.domain.CreatorActivityType
|
||||||
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.community.application.CreatorChannelCommunityQueryService
|
||||||
|
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityPost
|
||||||
|
import kr.co.vividnext.sodalive.v2.creator.channel.community.domain.CreatorChannelCommunityQueryPolicy
|
||||||
|
import kr.co.vividnext.sodalive.v2.creator.channel.community.port.out.CreatorChannelCommunityCreatorRecord
|
||||||
|
import kr.co.vividnext.sodalive.v2.creator.channel.community.port.out.CreatorChannelCommunityPostRecord
|
||||||
|
import kr.co.vividnext.sodalive.v2.creator.channel.community.port.out.CreatorChannelCommunityQueryPort
|
||||||
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.CreatorChannelCreator
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelCreator
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelDonation
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelDonation
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelFanTalk
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelFanTalk
|
||||||
@@ -30,7 +36,6 @@ import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelSer
|
|||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelSns
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.domain.CreatorChannelSns
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelActivityRecord
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelActivityRecord
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelAudioContentRecord
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelAudioContentRecord
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelCommunityPostRecord
|
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelCreatorRecord
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelCreatorRecord
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelDonationRecord
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelDonationRecord
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelFanTalkRecord
|
import kr.co.vividnext.sodalive.v2.creator.channel.home.port.out.CreatorChannelFanTalkRecord
|
||||||
@@ -49,6 +54,7 @@ import org.junit.jupiter.api.Assertions.assertTrue
|
|||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
|
import org.springframework.beans.factory.ObjectProvider
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
class CreatorChannelHomeQueryServiceTest {
|
class CreatorChannelHomeQueryServiceTest {
|
||||||
@@ -58,7 +64,8 @@ class CreatorChannelHomeQueryServiceTest {
|
|||||||
@DisplayName("크리에이터 채널 홈 서비스는 모든 섹션을 조립하고 최종 정책을 적용한다")
|
@DisplayName("크리에이터 채널 홈 서비스는 모든 섹션을 조립하고 최종 정책을 적용한다")
|
||||||
fun shouldAssembleCreatorChannelHomeWithFinalPolicies() {
|
fun shouldAssembleCreatorChannelHomeWithFinalPolicies() {
|
||||||
val port = FakeCreatorChannelHomeQueryPort()
|
val port = FakeCreatorChannelHomeQueryPort()
|
||||||
val service = createService(port, canViewAdultContent = false)
|
val communityPort = FakeCreatorChannelCommunityQueryPort()
|
||||||
|
val service = createService(port, communityPort, canViewAdultContent = false)
|
||||||
val viewer = createMember(id = 10L, gender = Gender.FEMALE, authGender = 1)
|
val viewer = createMember(id = 10L, gender = Gender.FEMALE, authGender = 1)
|
||||||
val now = LocalDateTime.of(2026, 6, 13, 10, 0)
|
val now = LocalDateTime.of(2026, 6, 13, 10, 0)
|
||||||
|
|
||||||
@@ -76,7 +83,13 @@ class CreatorChannelHomeQueryServiceTest {
|
|||||||
assertEquals(listOf(402L, 401L, 404L), home.schedules.map { it.targetId })
|
assertEquals(listOf(402L, 401L, 404L), home.schedules.map { it.targetId })
|
||||||
assertFalse(home.schedules.any { it.isAdult })
|
assertFalse(home.schedules.any { it.isAdult })
|
||||||
assertEquals("https://cdn.test/profile/fan.png", home.channelDonations.first().profileImageUrl)
|
assertEquals("https://cdn.test/profile/fan.png", home.channelDonations.first().profileImageUrl)
|
||||||
assertEquals("https://cdn.test/community.png", home.notices.first().imageUrl)
|
assertNull(home.notices.first().imageUrl)
|
||||||
|
assertNull(home.notices.first().audioUrl)
|
||||||
|
assertEquals(listOf(1L, 1L), communityPort.homeCreatorIds)
|
||||||
|
assertEquals(listOf(10L, 10L), communityPort.homeViewerIds)
|
||||||
|
assertEquals(listOf(true, false), communityPort.homeIsPinnedValues)
|
||||||
|
assertEquals(listOf(false, false), communityPort.homeCanViewAdultContentValues)
|
||||||
|
assertEquals(listOf(3, 3), communityPort.homeLimits)
|
||||||
assertEquals("https://cdn.test/series.png", home.series.first().coverImageUrl)
|
assertEquals("https://cdn.test/series.png", home.series.first().coverImageUrl)
|
||||||
assertEquals("introduce", home.introduce)
|
assertEquals("introduce", home.introduce)
|
||||||
assertEquals(Gender.MALE, port.currentLiveEffectiveViewerGender)
|
assertEquals(Gender.MALE, port.currentLiveEffectiveViewerGender)
|
||||||
@@ -272,10 +285,12 @@ class CreatorChannelHomeQueryServiceTest {
|
|||||||
audioUrl = "audio.mp3",
|
audioUrl = "audio.mp3",
|
||||||
content = "notice",
|
content = "notice",
|
||||||
price = 10,
|
price = 10,
|
||||||
date = LocalDateTime.of(2026, 6, 12, 4, 0),
|
createdAt = LocalDateTime.of(2026, 6, 12, 4, 0),
|
||||||
existOrdered = true,
|
existOrdered = true,
|
||||||
|
isCommentAvailable = true,
|
||||||
likeCount = 2,
|
likeCount = 2,
|
||||||
commentCount = 3
|
commentCount = 3,
|
||||||
|
isPinned = true
|
||||||
)
|
)
|
||||||
|
|
||||||
return CreatorChannelHome(
|
return CreatorChannelHome(
|
||||||
@@ -392,6 +407,7 @@ class CreatorChannelHomeQueryServiceTest {
|
|||||||
|
|
||||||
private fun createService(
|
private fun createService(
|
||||||
port: FakeCreatorChannelHomeQueryPort,
|
port: FakeCreatorChannelHomeQueryPort,
|
||||||
|
communityPort: FakeCreatorChannelCommunityQueryPort = FakeCreatorChannelCommunityQueryPort(),
|
||||||
canViewAdultContent: Boolean = true
|
canViewAdultContent: Boolean = true
|
||||||
): CreatorChannelHomeQueryService {
|
): CreatorChannelHomeQueryService {
|
||||||
val preferenceService = Mockito.mock(MemberContentPreferenceService::class.java)
|
val preferenceService = Mockito.mock(MemberContentPreferenceService::class.java)
|
||||||
@@ -408,8 +424,20 @@ class CreatorChannelHomeQueryServiceTest {
|
|||||||
val messageSource = SodaMessageSource()
|
val messageSource = SodaMessageSource()
|
||||||
val langContext = LangContext()
|
val langContext = LangContext()
|
||||||
langContext.setLang(Lang.KO)
|
langContext.setLang(Lang.KO)
|
||||||
|
val audioContentCloudFront = Mockito.mock(AudioContentCloudFront::class.java)
|
||||||
|
Mockito.`when`(audioContentCloudFront.generateSignedURL(Mockito.anyString(), Mockito.anyLong()))
|
||||||
|
.thenAnswer { invocation -> "https://signed.test/${invocation.getArgument<String>(0)}" }
|
||||||
return CreatorChannelHomeQueryService(
|
return CreatorChannelHomeQueryService(
|
||||||
queryPort = port,
|
queryPort = port,
|
||||||
|
communityQueryService = CreatorChannelCommunityQueryService(
|
||||||
|
queryPortProvider = FixedCreatorChannelCommunityQueryPortProvider(communityPort),
|
||||||
|
queryPolicy = CreatorChannelCommunityQueryPolicy(),
|
||||||
|
memberContentPreferenceService = preferenceService,
|
||||||
|
audioContentCloudFront = audioContentCloudFront,
|
||||||
|
messageSource = messageSource,
|
||||||
|
langContext = langContext,
|
||||||
|
cloudFrontHost = "https://cdn.test"
|
||||||
|
),
|
||||||
queryPolicy = CreatorChannelHomeQueryPolicy(),
|
queryPolicy = CreatorChannelHomeQueryPolicy(),
|
||||||
memberContentPreferenceService = preferenceService,
|
memberContentPreferenceService = preferenceService,
|
||||||
messageSource = messageSource,
|
messageSource = messageSource,
|
||||||
@@ -517,29 +545,6 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun findCommunityPosts(
|
|
||||||
creatorId: Long,
|
|
||||||
viewerId: Long?,
|
|
||||||
isFixed: Boolean,
|
|
||||||
canViewAdultContent: Boolean,
|
|
||||||
limit: Int
|
|
||||||
): List<CreatorChannelCommunityPostRecord> = listOf(
|
|
||||||
CreatorChannelCommunityPostRecord(
|
|
||||||
postId = if (isFixed) 301L else 302L,
|
|
||||||
creatorId = creatorId,
|
|
||||||
creatorNickname = "creator",
|
|
||||||
creatorProfilePath = "profile/creator.png",
|
|
||||||
imagePath = "community.png",
|
|
||||||
audioPath = "community.mp3",
|
|
||||||
content = if (isFixed) "notice" else "community",
|
|
||||||
price = 0,
|
|
||||||
date = LocalDateTime.of(2026, 6, 13, 7, 0),
|
|
||||||
existOrdered = false,
|
|
||||||
likeCount = 3,
|
|
||||||
commentCount = 4
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
override fun findSchedules(
|
override fun findSchedules(
|
||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
now: LocalDateTime,
|
now: LocalDateTime,
|
||||||
@@ -666,3 +671,70 @@ private class FakeCreatorChannelHomeQueryPort : CreatorChannelHomeQueryPort {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private class FixedCreatorChannelCommunityQueryPortProvider(
|
||||||
|
private val port: CreatorChannelCommunityQueryPort
|
||||||
|
) : ObjectProvider<CreatorChannelCommunityQueryPort> {
|
||||||
|
override fun getObject(vararg args: Any?): CreatorChannelCommunityQueryPort = port
|
||||||
|
|
||||||
|
override fun getIfAvailable(): CreatorChannelCommunityQueryPort = port
|
||||||
|
|
||||||
|
override fun getIfUnique(): CreatorChannelCommunityQueryPort = port
|
||||||
|
|
||||||
|
override fun getObject(): CreatorChannelCommunityQueryPort = port
|
||||||
|
}
|
||||||
|
|
||||||
|
private class FakeCreatorChannelCommunityQueryPort : CreatorChannelCommunityQueryPort {
|
||||||
|
val homeCreatorIds = mutableListOf<Long>()
|
||||||
|
val homeViewerIds = mutableListOf<Long>()
|
||||||
|
val homeIsPinnedValues = mutableListOf<Boolean>()
|
||||||
|
val homeCanViewAdultContentValues = mutableListOf<Boolean>()
|
||||||
|
val homeLimits = mutableListOf<Int>()
|
||||||
|
|
||||||
|
override fun findCreator(creatorId: Long, viewerId: Long?): CreatorChannelCommunityCreatorRecord? {
|
||||||
|
return CreatorChannelCommunityCreatorRecord(creatorId = creatorId, role = MemberRole.CREATOR, nickname = "creator")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun existsBlockedBetween(viewerId: Long, creatorId: Long): Boolean = false
|
||||||
|
|
||||||
|
override fun countCommunityPosts(creatorId: Long, viewerId: Long, canViewAdultContent: Boolean): Int = 0
|
||||||
|
|
||||||
|
override fun findCommunityPosts(
|
||||||
|
creatorId: Long,
|
||||||
|
viewerId: Long,
|
||||||
|
canViewAdultContent: Boolean,
|
||||||
|
offset: Long,
|
||||||
|
limit: Int
|
||||||
|
): List<CreatorChannelCommunityPostRecord> = emptyList()
|
||||||
|
|
||||||
|
override fun findHomeCommunityPosts(
|
||||||
|
creatorId: Long,
|
||||||
|
viewerId: Long,
|
||||||
|
isPinned: Boolean,
|
||||||
|
canViewAdultContent: Boolean,
|
||||||
|
limit: Int
|
||||||
|
): List<CreatorChannelCommunityPostRecord> {
|
||||||
|
homeCreatorIds += creatorId
|
||||||
|
homeViewerIds += viewerId
|
||||||
|
homeIsPinnedValues += isPinned
|
||||||
|
homeCanViewAdultContentValues += canViewAdultContent
|
||||||
|
homeLimits += limit
|
||||||
|
return listOf(
|
||||||
|
CreatorChannelCommunityPostRecord(
|
||||||
|
postId = if (isPinned) 301L else 302L,
|
||||||
|
creatorId = creatorId,
|
||||||
|
creatorNickname = "creator",
|
||||||
|
creatorProfilePath = "profile/creator.png",
|
||||||
|
imagePath = if (isPinned) "image/301.png" else "image/302.png",
|
||||||
|
audioPath = if (isPinned) "audio/301.mp3" else "audio/302.mp3",
|
||||||
|
content = if (isPinned) "notice" else "community",
|
||||||
|
price = 100,
|
||||||
|
createdAt = LocalDateTime.of(2026, 6, 13, 7, 0),
|
||||||
|
existOrdered = false,
|
||||||
|
isCommentAvailable = true,
|
||||||
|
likeCount = 3,
|
||||||
|
commentCount = 4,
|
||||||
|
isPinned = isPinned
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user