parent
7f70e508e4
commit
656fd9a1fa
|
@ -10,6 +10,7 @@ import kr.co.vividnext.sodalive.content.hashtag.QAudioContentHashTag.audioConten
|
|||
import kr.co.vividnext.sodalive.content.hashtag.QHashTag.hashTag
|
||||
import kr.co.vividnext.sodalive.content.main.curation.QAudioContentCuration.audioContentCuration
|
||||
import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.stereotype.Repository
|
||||
import java.time.LocalDateTime
|
||||
|
@ -25,7 +26,6 @@ interface AdminAudioContentQueryRepository {
|
|||
|
||||
fun getAudioContentList(
|
||||
status: ContentReleaseStatus = ContentReleaseStatus.OPEN,
|
||||
imageHost: String,
|
||||
offset: Long,
|
||||
limit: Long,
|
||||
searchWord: String = ""
|
||||
|
@ -35,7 +35,10 @@ interface AdminAudioContentQueryRepository {
|
|||
}
|
||||
|
||||
class AdminAudioContentQueryRepositoryImpl(
|
||||
private val queryFactory: JPAQueryFactory
|
||||
private val queryFactory: JPAQueryFactory,
|
||||
|
||||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val imageHost: String
|
||||
) : AdminAudioContentQueryRepository {
|
||||
override fun getAudioContentTotalCount(
|
||||
searchWord: String,
|
||||
|
@ -70,7 +73,6 @@ class AdminAudioContentQueryRepositoryImpl(
|
|||
|
||||
override fun getAudioContentList(
|
||||
status: ContentReleaseStatus,
|
||||
imageHost: String,
|
||||
offset: Long,
|
||||
limit: Long,
|
||||
searchWord: String
|
||||
|
|
|
@ -4,7 +4,6 @@ import kr.co.vividnext.sodalive.admin.content.curation.AdminContentCurationRepos
|
|||
import kr.co.vividnext.sodalive.admin.content.theme.AdminContentThemeRepository
|
||||
import kr.co.vividnext.sodalive.aws.cloudfront.AudioContentCloudFront
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.data.repository.findByIdOrNull
|
||||
import org.springframework.stereotype.Service
|
||||
|
@ -15,16 +14,12 @@ class AdminContentService(
|
|||
private val repository: AdminContentRepository,
|
||||
private val themeRepository: AdminContentThemeRepository,
|
||||
private val audioContentCloudFront: AudioContentCloudFront,
|
||||
private val curationRepository: AdminContentCurationRepository,
|
||||
|
||||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val coverImageHost: String
|
||||
private val curationRepository: AdminContentCurationRepository
|
||||
) {
|
||||
fun getAudioContentList(status: ContentReleaseStatus, pageable: Pageable): GetAdminContentListResponse {
|
||||
val totalCount = repository.getAudioContentTotalCount()
|
||||
val audioContentAndThemeList = repository.getAudioContentList(
|
||||
status = status,
|
||||
imageHost = coverImageHost,
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize.toLong()
|
||||
)
|
||||
|
@ -52,14 +47,12 @@ class AdminContentService(
|
|||
if (searchWord.length < 2) throw SodaException("2글자 이상 입력하세요.")
|
||||
val totalCount = repository.getAudioContentTotalCount(searchWord)
|
||||
val audioContentAndThemeList = repository.getAudioContentList(
|
||||
imageHost = coverImageHost,
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize.toLong(),
|
||||
searchWord = searchWord
|
||||
)
|
||||
|
||||
val audioContentList = audioContentAndThemeList
|
||||
.asSequence()
|
||||
.map {
|
||||
val tags = repository
|
||||
.getHashTagList(audioContentId = it.audioContentId)
|
||||
|
@ -74,7 +67,6 @@ class AdminContentService(
|
|||
)
|
||||
it
|
||||
}
|
||||
.toList()
|
||||
|
||||
return GetAdminContentListResponse(totalCount, audioContentList)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue