feat(content-preference): 콘텐츠 조회 설정 서버 저장 전환을 반영한다
This commit is contained in:
@@ -23,8 +23,8 @@ class LiveApiController(
|
||||
) = run {
|
||||
ApiResponse.ok(
|
||||
service.fetchData(
|
||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType,
|
||||
timezone = timezone,
|
||||
member = member
|
||||
)
|
||||
|
||||
@@ -8,6 +8,8 @@ import kr.co.vividnext.sodalive.live.room.LiveRoomService
|
||||
import kr.co.vividnext.sodalive.live.room.LiveRoomStatus
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.member.block.BlockMemberRepository
|
||||
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
||||
import kr.co.vividnext.sodalive.member.contentpreference.ViewerContentPreference
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@@ -17,22 +19,24 @@ class LiveApiService(
|
||||
private val contentService: AudioContentService,
|
||||
private val recommendService: LiveRecommendService,
|
||||
private val creatorCommunityService: CreatorCommunityService,
|
||||
private val memberContentPreferenceService: MemberContentPreferenceService,
|
||||
|
||||
private val blockMemberRepository: BlockMemberRepository
|
||||
) {
|
||||
fun fetchData(
|
||||
isAdultContentVisible: Boolean,
|
||||
contentType: ContentType,
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?,
|
||||
timezone: String,
|
||||
member: Member?
|
||||
): LiveMainResponse {
|
||||
val preference = resolvePreference(member, isAdultContentVisible, contentType)
|
||||
val memberId = member?.id
|
||||
val isAdult = member?.auth != null && isAdultContentVisible
|
||||
val isAdult = preference.isAdult
|
||||
|
||||
val liveOnAirRoomList = liveService.getRoomList(
|
||||
dateString = null,
|
||||
status = LiveRoomStatus.NOW,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
isAdultContentVisible = isAdult,
|
||||
pageable = Pageable.ofSize(20),
|
||||
member = member,
|
||||
timezone = timezone
|
||||
@@ -55,7 +59,7 @@ class LiveApiService(
|
||||
val replayLive = contentService.getLatestContentByTheme(
|
||||
memberId = memberId,
|
||||
theme = listOf("다시듣기"),
|
||||
contentType = contentType,
|
||||
contentType = preference.contentType,
|
||||
isFree = false,
|
||||
isAdult = isAdult
|
||||
)
|
||||
@@ -77,7 +81,7 @@ class LiveApiService(
|
||||
val liveReservationRoomList = liveService.getRoomList(
|
||||
dateString = null,
|
||||
status = LiveRoomStatus.RESERVATION,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
isAdultContentVisible = isAdult,
|
||||
pageable = Pageable.ofSize(10),
|
||||
member = member,
|
||||
timezone = timezone
|
||||
@@ -93,4 +97,25 @@ class LiveApiService(
|
||||
liveReservationRoomList = liveReservationRoomList
|
||||
)
|
||||
}
|
||||
|
||||
private fun resolvePreference(
|
||||
member: Member?,
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?
|
||||
): ViewerContentPreference {
|
||||
if (member == null) {
|
||||
return ViewerContentPreference(
|
||||
countryCode = "KR",
|
||||
isAdultContentVisible = isAdultContentVisible ?: false,
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
isAdult = false
|
||||
)
|
||||
}
|
||||
|
||||
return memberContentPreferenceService.resolveForQuery(
|
||||
member = member,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user