test #142
@@ -19,7 +19,13 @@ interface AdminContentRepository : JpaRepository<AudioContent, Long>, AdminAudio
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
interface AdminAudioContentQueryRepository {
 | 
					interface AdminAudioContentQueryRepository {
 | 
				
			||||||
    fun getAudioContentTotalCount(searchWord: String = ""): Int
 | 
					    fun getAudioContentTotalCount(searchWord: String = ""): Int
 | 
				
			||||||
    fun getAudioContentList(offset: Long, limit: Long, searchWord: String = ""): List<GetAdminContentListItem>
 | 
					    fun getAudioContentList(
 | 
				
			||||||
 | 
					        imageHost: String,
 | 
				
			||||||
 | 
					        offset: Long,
 | 
				
			||||||
 | 
					        limit: Long,
 | 
				
			||||||
 | 
					        searchWord: String = ""
 | 
				
			||||||
 | 
					    ): List<GetAdminContentListItem>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fun getHashTagList(audioContentId: Long): List<String>
 | 
					    fun getHashTagList(audioContentId: Long): List<String>
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -46,7 +52,12 @@ class AdminAudioContentQueryRepositoryImpl(
 | 
				
			|||||||
            .size
 | 
					            .size
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    override fun getAudioContentList(offset: Long, limit: Long, searchWord: String): List<GetAdminContentListItem> {
 | 
					    override fun getAudioContentList(
 | 
				
			||||||
 | 
					        imageHost: String,
 | 
				
			||||||
 | 
					        offset: Long,
 | 
				
			||||||
 | 
					        limit: Long,
 | 
				
			||||||
 | 
					        searchWord: String
 | 
				
			||||||
 | 
					    ): List<GetAdminContentListItem> {
 | 
				
			||||||
        var where = audioContent.duration.isNotNull
 | 
					        var where = audioContent.duration.isNotNull
 | 
				
			||||||
            .and(audioContent.member.isNotNull)
 | 
					            .and(audioContent.member.isNotNull)
 | 
				
			||||||
            .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull))
 | 
					            .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull))
 | 
				
			||||||
@@ -64,9 +75,10 @@ class AdminAudioContentQueryRepositoryImpl(
 | 
				
			|||||||
                    audioContent.id,
 | 
					                    audioContent.id,
 | 
				
			||||||
                    audioContent.title,
 | 
					                    audioContent.title,
 | 
				
			||||||
                    audioContent.detail,
 | 
					                    audioContent.detail,
 | 
				
			||||||
 | 
					                    Expressions.stringTemplate("GROUP_CONCAT({0} SEPARATOR ' '", hashTag.tag),
 | 
				
			||||||
                    audioContentCuration.title,
 | 
					                    audioContentCuration.title,
 | 
				
			||||||
                    audioContentCuration.id.nullif(0),
 | 
					                    audioContentCuration.id.nullif(0),
 | 
				
			||||||
                    audioContent.coverImage,
 | 
					                    audioContent.coverImage.prepend("/").prepend(imageHost),
 | 
				
			||||||
                    audioContent.member!!.nickname,
 | 
					                    audioContent.member!!.nickname,
 | 
				
			||||||
                    audioContentTheme.theme,
 | 
					                    audioContentTheme.theme,
 | 
				
			||||||
                    audioContentTheme.id,
 | 
					                    audioContentTheme.id,
 | 
				
			||||||
@@ -81,8 +93,11 @@ class AdminAudioContentQueryRepositoryImpl(
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
            .from(audioContent)
 | 
					            .from(audioContent)
 | 
				
			||||||
            .leftJoin(audioContent.curation, audioContentCuration)
 | 
					            .leftJoin(audioContent.curation, audioContentCuration)
 | 
				
			||||||
 | 
					            .leftJoin(audioContent.audioContentHashTags, audioContentHashTag)
 | 
				
			||||||
 | 
					            .leftJoin(audioContentHashTag.hashTag, hashTag)
 | 
				
			||||||
            .innerJoin(audioContent.theme, audioContentTheme)
 | 
					            .innerJoin(audioContent.theme, audioContentTheme)
 | 
				
			||||||
            .where(where)
 | 
					            .where(where)
 | 
				
			||||||
 | 
					            .groupBy(audioContent.id)
 | 
				
			||||||
            .offset(offset)
 | 
					            .offset(offset)
 | 
				
			||||||
            .limit(limit)
 | 
					            .limit(limit)
 | 
				
			||||||
            .orderBy(audioContent.releaseDate.desc())
 | 
					            .orderBy(audioContent.releaseDate.desc())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,19 +23,13 @@ class AdminContentService(
 | 
				
			|||||||
    fun getAudioContentList(pageable: Pageable): GetAdminContentListResponse {
 | 
					    fun getAudioContentList(pageable: Pageable): GetAdminContentListResponse {
 | 
				
			||||||
        val totalCount = repository.getAudioContentTotalCount()
 | 
					        val totalCount = repository.getAudioContentTotalCount()
 | 
				
			||||||
        val audioContentAndThemeList = repository.getAudioContentList(
 | 
					        val audioContentAndThemeList = repository.getAudioContentList(
 | 
				
			||||||
 | 
					            imageHost = coverImageHost,
 | 
				
			||||||
            offset = pageable.offset,
 | 
					            offset = pageable.offset,
 | 
				
			||||||
            limit = pageable.pageSize.toLong()
 | 
					            limit = pageable.pageSize.toLong()
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        val audioContentList = audioContentAndThemeList
 | 
					        val audioContentList = audioContentAndThemeList
 | 
				
			||||||
            .asSequence()
 | 
					            .asSequence()
 | 
				
			||||||
            .map {
 | 
					 | 
				
			||||||
                val tags = repository
 | 
					 | 
				
			||||||
                    .getHashTagList(audioContentId = it.audioContentId)
 | 
					 | 
				
			||||||
                    .joinToString(" ") { tag -> tag }
 | 
					 | 
				
			||||||
                it.tags = tags
 | 
					 | 
				
			||||||
                it
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            .map {
 | 
					            .map {
 | 
				
			||||||
                it.contentUrl = audioContentCloudFront.generateSignedURL(
 | 
					                it.contentUrl = audioContentCloudFront.generateSignedURL(
 | 
				
			||||||
                    resourcePath = it.contentUrl,
 | 
					                    resourcePath = it.contentUrl,
 | 
				
			||||||
@@ -43,10 +37,6 @@ class AdminContentService(
 | 
				
			|||||||
                )
 | 
					                )
 | 
				
			||||||
                it
 | 
					                it
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            .map {
 | 
					 | 
				
			||||||
                it.coverImageUrl = "$coverImageHost/${it.coverImageUrl}"
 | 
					 | 
				
			||||||
                it
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            .toList()
 | 
					            .toList()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return GetAdminContentListResponse(totalCount, audioContentList)
 | 
					        return GetAdminContentListResponse(totalCount, audioContentList)
 | 
				
			||||||
@@ -56,6 +46,7 @@ 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
 | 
				
			||||||
@@ -63,13 +54,6 @@ class AdminContentService(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        val audioContentList = audioContentAndThemeList
 | 
					        val audioContentList = audioContentAndThemeList
 | 
				
			||||||
            .asSequence()
 | 
					            .asSequence()
 | 
				
			||||||
            .map {
 | 
					 | 
				
			||||||
                val tags = repository
 | 
					 | 
				
			||||||
                    .getHashTagList(audioContentId = it.audioContentId)
 | 
					 | 
				
			||||||
                    .joinToString(" ") { tag -> tag }
 | 
					 | 
				
			||||||
                it.tags = tags
 | 
					 | 
				
			||||||
                it
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            .map {
 | 
					            .map {
 | 
				
			||||||
                it.contentUrl = audioContentCloudFront.generateSignedURL(
 | 
					                it.contentUrl = audioContentCloudFront.generateSignedURL(
 | 
				
			||||||
                    resourcePath = it.contentUrl,
 | 
					                    resourcePath = it.contentUrl,
 | 
				
			||||||
@@ -77,10 +61,6 @@ class AdminContentService(
 | 
				
			|||||||
                )
 | 
					                )
 | 
				
			||||||
                it
 | 
					                it
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            .map {
 | 
					 | 
				
			||||||
                it.coverImageUrl = "$coverImageHost/${it.coverImageUrl}"
 | 
					 | 
				
			||||||
                it
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            .toList()
 | 
					            .toList()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return GetAdminContentListResponse(totalCount, audioContentList)
 | 
					        return GetAdminContentListResponse(totalCount, audioContentList)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@ data class GetAdminContentListItem @QueryProjection constructor(
 | 
				
			|||||||
    val audioContentId: Long,
 | 
					    val audioContentId: Long,
 | 
				
			||||||
    val title: String,
 | 
					    val title: String,
 | 
				
			||||||
    val detail: String,
 | 
					    val detail: String,
 | 
				
			||||||
 | 
					    var tags: String,
 | 
				
			||||||
    val curationTitle: String?,
 | 
					    val curationTitle: String?,
 | 
				
			||||||
    val curationId: Long,
 | 
					    val curationId: Long,
 | 
				
			||||||
    var coverImageUrl: String,
 | 
					    var coverImageUrl: String,
 | 
				
			||||||
@@ -24,6 +25,4 @@ data class GetAdminContentListItem @QueryProjection constructor(
 | 
				
			|||||||
    val isCommentAvailable: Boolean,
 | 
					    val isCommentAvailable: Boolean,
 | 
				
			||||||
    val date: String,
 | 
					    val date: String,
 | 
				
			||||||
    val releaseDate: String?
 | 
					    val releaseDate: String?
 | 
				
			||||||
) {
 | 
					)
 | 
				
			||||||
    var tags: String = ""
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user