test #258
|
@ -113,7 +113,9 @@ interface AudioContentQueryRepository {
|
|||
fun findAudioContentByCurationIdV2(
|
||||
curationId: Long,
|
||||
memberId: Long,
|
||||
isAdult: Boolean
|
||||
isAdult: Boolean,
|
||||
offset: Long = 0,
|
||||
limit: Long = 20
|
||||
): List<GetAudioContentMainItem>
|
||||
|
||||
fun getAudioContentRanking(
|
||||
|
@ -658,7 +660,9 @@ class AudioContentQueryRepositoryImpl(
|
|||
override fun findAudioContentByCurationIdV2(
|
||||
curationId: Long,
|
||||
memberId: Long,
|
||||
isAdult: Boolean
|
||||
isAdult: Boolean,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): List<GetAudioContentMainItem> {
|
||||
val blockMemberCondition = blockMember.member.id.eq(member.id)
|
||||
.and(blockMember.isActive.isTrue)
|
||||
|
@ -696,6 +700,8 @@ class AudioContentQueryRepositoryImpl(
|
|||
.innerJoin(audioContent.member, member)
|
||||
.leftJoin(blockMember).on(blockMemberCondition)
|
||||
.where(where)
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
.fetch()
|
||||
}
|
||||
|
||||
|
|
|
@ -109,9 +109,7 @@ class AudioContentCurationQueryRepository(private val queryFactory: JPAQueryFact
|
|||
fun findByContentMainTabIdAndTitle(
|
||||
tabId: Long,
|
||||
title: String,
|
||||
isAdult: Boolean,
|
||||
offset: Long = 0,
|
||||
limit: Long = 12
|
||||
isAdult: Boolean
|
||||
): List<AudioContentCuration> {
|
||||
var where = audioContentCuration.isActive.isTrue
|
||||
.and(audioContentMainTab.id.eq(tabId))
|
||||
|
|
|
@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.content.main.tab.free
|
|||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
|
@ -19,4 +20,20 @@ class AudioContentMainTabFreeController(private val service: AudioContentMainTab
|
|||
|
||||
ApiResponse.ok(service.fetchData(member))
|
||||
}
|
||||
|
||||
@GetMapping("/introduce-creator")
|
||||
fun getIntroduceCreator(
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
pageable: Pageable
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.getIntroduceCreator(
|
||||
member,
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize.toLong()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.content.main.tab.free
|
|||
|
||||
import kr.co.vividnext.sodalive.content.AudioContentRepository
|
||||
import kr.co.vividnext.sodalive.content.ContentType
|
||||
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem
|
||||
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerService
|
||||
import kr.co.vividnext.sodalive.content.main.curation.AudioContentCurationQueryRepository
|
||||
import kr.co.vividnext.sodalive.content.main.tab.GetContentCurationResponse
|
||||
|
@ -89,4 +90,27 @@ class AudioContentMainTabFreeService(
|
|||
curationList = curationList
|
||||
)
|
||||
}
|
||||
|
||||
fun getIntroduceCreator(member: Member, offset: Long, limit: Long): List<GetAudioContentMainItem> {
|
||||
val isAdult = member.auth != null
|
||||
val memberId = member.id!!
|
||||
|
||||
val introduceCreatorCuration = curationRepository.findByContentMainTabIdAndTitle(
|
||||
tabId = 7L,
|
||||
title = "크리에이터 소개",
|
||||
isAdult = isAdult
|
||||
)
|
||||
|
||||
return if (introduceCreatorCuration.isNotEmpty()) {
|
||||
contentRepository.findAudioContentByCurationIdV2(
|
||||
curationId = introduceCreatorCuration[0].id!!,
|
||||
memberId = memberId,
|
||||
isAdult = isAdult,
|
||||
offset = offset,
|
||||
limit = limit
|
||||
)
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue