fix(content-preference): 조회 API 선호도 쿼리 파라미터를 제거한다
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package kr.co.vividnext.sodalive.api.live
|
||||
|
||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import kr.co.vividnext.sodalive.content.ContentType
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
@@ -17,14 +16,10 @@ class LiveApiController(
|
||||
@GetMapping
|
||||
fun fetchData(
|
||||
@RequestParam timezone: String,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
ApiResponse.ok(
|
||||
service.fetchData(
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType,
|
||||
timezone = timezone,
|
||||
member = member
|
||||
)
|
||||
|
||||
@@ -24,19 +24,16 @@ class LiveApiService(
|
||||
private val blockMemberRepository: BlockMemberRepository
|
||||
) {
|
||||
fun fetchData(
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?,
|
||||
timezone: String,
|
||||
member: Member?
|
||||
): LiveMainResponse {
|
||||
val preference = resolvePreference(member, isAdultContentVisible, contentType)
|
||||
val preference = resolvePreference(member)
|
||||
val memberId = member?.id
|
||||
val isAdult = preference.isAdult
|
||||
|
||||
val liveOnAirRoomList = liveService.getRoomList(
|
||||
dateString = null,
|
||||
status = LiveRoomStatus.NOW,
|
||||
isAdultContentVisible = isAdult,
|
||||
pageable = Pageable.ofSize(20),
|
||||
member = member,
|
||||
timezone = timezone
|
||||
@@ -81,7 +78,6 @@ class LiveApiService(
|
||||
val liveReservationRoomList = liveService.getRoomList(
|
||||
dateString = null,
|
||||
status = LiveRoomStatus.RESERVATION,
|
||||
isAdultContentVisible = isAdult,
|
||||
pageable = Pageable.ofSize(10),
|
||||
member = member,
|
||||
timezone = timezone
|
||||
@@ -98,16 +94,12 @@ class LiveApiService(
|
||||
)
|
||||
}
|
||||
|
||||
private fun resolvePreference(
|
||||
member: Member?,
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?
|
||||
): ViewerContentPreference {
|
||||
private fun resolvePreference(member: Member?): ViewerContentPreference {
|
||||
if (member == null) {
|
||||
return ViewerContentPreference(
|
||||
countryCode = "KR",
|
||||
isAdultContentVisible = isAdultContentVisible ?: false,
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
isAdultContentVisible = false,
|
||||
contentType = ContentType.ALL,
|
||||
isAdult = false
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user