fix(content-preference): 조회 API 선호도 쿼리 파라미터를 제거한다
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package kr.co.vividnext.sodalive.api.home
|
||||
|
||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import kr.co.vividnext.sodalive.content.ContentType
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.SeriesPublishedDaysOfWeek
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.rank.ContentRankingSortType
|
||||
@@ -17,15 +16,11 @@ class HomeController(private val service: HomeService) {
|
||||
@GetMapping
|
||||
fun fetchData(
|
||||
@RequestParam timezone: String,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
ApiResponse.ok(
|
||||
service.fetchData(
|
||||
timezone = timezone,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType,
|
||||
member
|
||||
)
|
||||
)
|
||||
@@ -34,15 +29,11 @@ class HomeController(private val service: HomeService) {
|
||||
@GetMapping("/latest-content")
|
||||
fun getLatestContentByTheme(
|
||||
@RequestParam("theme") theme: String,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
ApiResponse.ok(
|
||||
service.getLatestContentByTheme(
|
||||
theme = theme,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType,
|
||||
member
|
||||
)
|
||||
)
|
||||
@@ -51,15 +42,11 @@ class HomeController(private val service: HomeService) {
|
||||
@GetMapping("/day-of-week-series")
|
||||
fun getDayOfWeekSeriesList(
|
||||
@RequestParam("dayOfWeek") dayOfWeek: SeriesPublishedDaysOfWeek,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
ApiResponse.ok(
|
||||
service.getDayOfWeekSeriesList(
|
||||
dayOfWeek = dayOfWeek,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType,
|
||||
member
|
||||
)
|
||||
)
|
||||
@@ -68,14 +55,10 @@ class HomeController(private val service: HomeService) {
|
||||
// 추천 콘텐츠만 새로고침하기 위한 엔드포인트
|
||||
@GetMapping("/recommend-contents")
|
||||
fun getRecommendContents(
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
ApiResponse.ok(
|
||||
service.getRecommendContentList(
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType,
|
||||
member = member
|
||||
)
|
||||
)
|
||||
@@ -85,8 +68,6 @@ class HomeController(private val service: HomeService) {
|
||||
@GetMapping("/content-ranking")
|
||||
fun getContentRanking(
|
||||
@RequestParam("sort", required = false) sort: ContentRankingSortType? = null,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@RequestParam("offset", required = false) offset: Long? = null,
|
||||
@RequestParam("limit", required = false) limit: Long? = null,
|
||||
@RequestParam("theme", required = false) theme: String? = null,
|
||||
@@ -95,8 +76,6 @@ class HomeController(private val service: HomeService) {
|
||||
ApiResponse.ok(
|
||||
service.getContentRankingBySort(
|
||||
sort = sort ?: ContentRankingSortType.REVENUE,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType,
|
||||
offset = offset,
|
||||
limit = limit,
|
||||
theme = theme,
|
||||
|
||||
@@ -72,11 +72,9 @@ class HomeService(
|
||||
|
||||
fun fetchData(
|
||||
timezone: String,
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?,
|
||||
member: Member?
|
||||
): GetHomeResponse {
|
||||
val preference = resolvePreference(member, isAdultContentVisible, contentType)
|
||||
val preference = resolvePreference(member)
|
||||
val memberId = member?.id
|
||||
val isAdult = preference.isAdult
|
||||
val resolvedContentType = preference.contentType
|
||||
@@ -84,7 +82,6 @@ class HomeService(
|
||||
val liveList = liveRoomService.getRoomList(
|
||||
dateString = null,
|
||||
status = LiveRoomStatus.NOW,
|
||||
isAdultContentVisible = isAdult,
|
||||
pageable = Pageable.ofSize(10),
|
||||
member = member,
|
||||
timezone = timezone
|
||||
@@ -227,11 +224,9 @@ class HomeService(
|
||||
|
||||
fun getLatestContentByTheme(
|
||||
theme: String,
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?,
|
||||
member: Member?
|
||||
): List<AudioContentMainItem> {
|
||||
val preference = resolvePreference(member, isAdultContentVisible, contentType)
|
||||
val preference = resolvePreference(member)
|
||||
val memberId = member?.id
|
||||
val isAdult = preference.isAdult
|
||||
val resolvedContentType = preference.contentType
|
||||
@@ -258,11 +253,9 @@ class HomeService(
|
||||
|
||||
fun getDayOfWeekSeriesList(
|
||||
dayOfWeek: SeriesPublishedDaysOfWeek,
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?,
|
||||
member: Member?
|
||||
): List<GetSeriesListResponse.SeriesListItem> {
|
||||
val preference = resolvePreference(member, isAdultContentVisible, contentType)
|
||||
val preference = resolvePreference(member)
|
||||
val memberId = member?.id
|
||||
val isAdult = preference.isAdult
|
||||
|
||||
@@ -276,14 +269,12 @@ class HomeService(
|
||||
|
||||
fun getContentRankingBySort(
|
||||
sort: ContentRankingSortType,
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?,
|
||||
offset: Long?,
|
||||
limit: Long?,
|
||||
theme: String?,
|
||||
member: Member?
|
||||
): List<GetAudioContentRankingItem> {
|
||||
val preference = resolvePreference(member, isAdultContentVisible, contentType)
|
||||
val preference = resolvePreference(member)
|
||||
val memberId = member?.id
|
||||
val isAdult = preference.isAdult
|
||||
|
||||
@@ -328,12 +319,10 @@ class HomeService(
|
||||
}
|
||||
|
||||
fun getRecommendContentList(
|
||||
isAdultContentVisible: Boolean?,
|
||||
contentType: ContentType?,
|
||||
member: Member?,
|
||||
excludeContentIds: List<Long> = emptyList()
|
||||
): List<AudioContentMainItem> {
|
||||
val preference = resolvePreference(member, isAdultContentVisible, contentType)
|
||||
val preference = resolvePreference(member)
|
||||
return getRecommendContentListByPreference(preference, member, excludeContentIds)
|
||||
}
|
||||
|
||||
@@ -391,16 +380,12 @@ class HomeService(
|
||||
return result.take(RECOMMEND_TARGET_SIZE).shuffled()
|
||||
}
|
||||
|
||||
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
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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