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