Compare commits
No commits in common. "286629836c238f521c2751861dd0277e05606560" and "a6a279837d53bc00c2d7f7d50cbad98dba2de257" have entirely different histories.
286629836c
...
a6a279837d
|
@ -194,13 +194,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
.where(where)
|
.where(where)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.orderBy(
|
.orderBy(pinContent.isActive.desc(), pinContent.updatedAt.desc(), orderBy, audioContent.id.desc())
|
||||||
pinContent.isActive.desc(),
|
|
||||||
pinContent.updatedAt.desc(),
|
|
||||||
orderBy,
|
|
||||||
audioContent.updatedAt.desc(),
|
|
||||||
audioContent.id.desc()
|
|
||||||
)
|
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,13 @@ import org.springframework.web.multipart.MultipartFile
|
||||||
class CreatorAdminContentController(private val service: CreatorAdminContentService) {
|
class CreatorAdminContentController(private val service: CreatorAdminContentService) {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
fun getAudioContentList(
|
fun getAudioContentList(
|
||||||
pageable: Pageable,
|
@RequestParam("category-id", required = false) categoryId: Long? = 0,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||||
|
pageable: Pageable
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||||
|
|
||||||
ApiResponse.ok(service.getAudioContentList(pageable, member))
|
ApiResponse.ok(service.getAudioContentList(pageable, member, categoryId ?: 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/search")
|
@GetMapping("/search")
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.querydsl.core.types.dsl.StringTemplate
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||||
import kr.co.vividnext.sodalive.content.AudioContent
|
import kr.co.vividnext.sodalive.content.AudioContent
|
||||||
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
||||||
|
import kr.co.vividnext.sodalive.content.category.QCategoryContent.categoryContent
|
||||||
import kr.co.vividnext.sodalive.content.hashtag.QAudioContentHashTag.audioContentHashTag
|
import kr.co.vividnext.sodalive.content.hashtag.QAudioContentHashTag.audioContentHashTag
|
||||||
import kr.co.vividnext.sodalive.content.hashtag.QHashTag.hashTag
|
import kr.co.vividnext.sodalive.content.hashtag.QHashTag.hashTag
|
||||||
import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme
|
import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme
|
||||||
|
@ -16,11 +17,12 @@ import java.time.LocalDateTime
|
||||||
interface CreatorAdminContentRepository : JpaRepository<AudioContent, Long>, CreatorAdminAudioContentQueryRepository
|
interface CreatorAdminContentRepository : JpaRepository<AudioContent, Long>, CreatorAdminAudioContentQueryRepository
|
||||||
|
|
||||||
interface CreatorAdminAudioContentQueryRepository {
|
interface CreatorAdminAudioContentQueryRepository {
|
||||||
fun getAudioContentTotalCount(memberId: Long, searchWord: String = ""): Int
|
fun getAudioContentTotalCount(memberId: Long, searchWord: String = "", categoryId: Long = 0): Int
|
||||||
fun getAudioContentList(
|
fun getAudioContentList(
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long,
|
limit: Long,
|
||||||
|
categoryId: Long = 0,
|
||||||
searchWord: String = ""
|
searchWord: String = ""
|
||||||
): List<GetCreatorAdminContentListItem>
|
): List<GetCreatorAdminContentListItem>
|
||||||
|
|
||||||
|
@ -32,7 +34,7 @@ interface CreatorAdminAudioContentQueryRepository {
|
||||||
class CreatorAdminAudioContentQueryRepositoryImpl(
|
class CreatorAdminAudioContentQueryRepositoryImpl(
|
||||||
private val queryFactory: JPAQueryFactory
|
private val queryFactory: JPAQueryFactory
|
||||||
) : CreatorAdminAudioContentQueryRepository {
|
) : CreatorAdminAudioContentQueryRepository {
|
||||||
override fun getAudioContentTotalCount(memberId: Long, searchWord: String): Int {
|
override fun getAudioContentTotalCount(memberId: Long, searchWord: String, categoryId: Long): Int {
|
||||||
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))
|
||||||
|
@ -45,9 +47,15 @@ class CreatorAdminAudioContentQueryRepositoryImpl(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (categoryId > 0) {
|
||||||
|
where = where.and(categoryContent.category.id.eq(categoryId))
|
||||||
|
}
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(audioContent.id)
|
.select(audioContent.id)
|
||||||
.from(audioContent)
|
.from(audioContent)
|
||||||
|
.leftJoin(categoryContent)
|
||||||
|
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
|
||||||
.where(where)
|
.where(where)
|
||||||
.fetch()
|
.fetch()
|
||||||
.size
|
.size
|
||||||
|
@ -57,6 +65,7 @@ class CreatorAdminAudioContentQueryRepositoryImpl(
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long,
|
limit: Long,
|
||||||
|
categoryId: Long,
|
||||||
searchWord: String
|
searchWord: String
|
||||||
): List<GetCreatorAdminContentListItem> {
|
): List<GetCreatorAdminContentListItem> {
|
||||||
var where = audioContent.duration.isNotNull
|
var where = audioContent.duration.isNotNull
|
||||||
|
@ -64,6 +73,10 @@ class CreatorAdminAudioContentQueryRepositoryImpl(
|
||||||
.and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull))
|
.and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull))
|
||||||
.and(audioContent.member.id.eq(memberId))
|
.and(audioContent.member.id.eq(memberId))
|
||||||
|
|
||||||
|
if (categoryId > 0) {
|
||||||
|
where = where.and(categoryContent.category.id.eq(categoryId))
|
||||||
|
}
|
||||||
|
|
||||||
if (searchWord.trim().length > 1) {
|
if (searchWord.trim().length > 1) {
|
||||||
where = where.and(
|
where = where.and(
|
||||||
audioContent.title.contains(searchWord)
|
audioContent.title.contains(searchWord)
|
||||||
|
@ -91,6 +104,8 @@ class CreatorAdminAudioContentQueryRepositoryImpl(
|
||||||
)
|
)
|
||||||
.from(audioContent)
|
.from(audioContent)
|
||||||
.innerJoin(audioContent.theme, audioContentTheme)
|
.innerJoin(audioContent.theme, audioContentTheme)
|
||||||
|
.leftJoin(categoryContent)
|
||||||
|
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
|
||||||
.where(where)
|
.where(where)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
|
|
|
@ -26,12 +26,13 @@ class CreatorAdminContentService(
|
||||||
@Value("\${cloud.aws.cloud-front.host}")
|
@Value("\${cloud.aws.cloud-front.host}")
|
||||||
private val coverImageHost: String
|
private val coverImageHost: String
|
||||||
) {
|
) {
|
||||||
fun getAudioContentList(pageable: Pageable, member: Member): GetCreatorAdminContentListResponse {
|
fun getAudioContentList(pageable: Pageable, member: Member, categoryId: Long): GetCreatorAdminContentListResponse {
|
||||||
val totalCount = repository.getAudioContentTotalCount(memberId = member.id!!)
|
val totalCount = repository.getAudioContentTotalCount(memberId = member.id!!, categoryId = categoryId)
|
||||||
val audioContentAndThemeList = repository.getAudioContentList(
|
val audioContentAndThemeList = repository.getAudioContentList(
|
||||||
memberId = member.id!!,
|
memberId = member.id!!,
|
||||||
offset = pageable.offset,
|
offset = pageable.offset,
|
||||||
limit = pageable.pageSize.toLong()
|
limit = pageable.pageSize.toLong(),
|
||||||
|
categoryId = categoryId
|
||||||
)
|
)
|
||||||
|
|
||||||
val audioContentList = audioContentAndThemeList
|
val audioContentList = audioContentAndThemeList
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.creator.admin.content.category
|
|
||||||
|
|
||||||
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.access.prepost.PreAuthorize
|
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam
|
|
||||||
import org.springframework.web.bind.annotation.RestController
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@PreAuthorize("hasRole('CREATOR')")
|
|
||||||
@RequestMapping("/creator-admin/content-category")
|
|
||||||
class CreatorAdminCategoryController(private val service: CreatorAdminCategoryService) {
|
|
||||||
@GetMapping("/search")
|
|
||||||
fun searchContentNotInCategory(
|
|
||||||
@RequestParam(value = "category_id") categoryId: Long,
|
|
||||||
@RequestParam(value = "search_word") searchWord: String,
|
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
|
||||||
) = run {
|
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
|
||||||
|
|
||||||
ApiResponse.ok(
|
|
||||||
service.searchContentNotInCategory(
|
|
||||||
categoryId = categoryId,
|
|
||||||
searchWord = searchWord,
|
|
||||||
memberId = member.id!!
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
fun getContentInCategory(
|
|
||||||
@RequestParam(value = "category_id") categoryId: Long,
|
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
|
||||||
pageable: Pageable
|
|
||||||
) = run {
|
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
|
||||||
|
|
||||||
ApiResponse.ok(
|
|
||||||
service.getContentInCategory(
|
|
||||||
categoryId = categoryId,
|
|
||||||
memberId = member.id!!,
|
|
||||||
offset = pageable.offset,
|
|
||||||
limit = pageable.pageSize.toLong()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.creator.admin.content.category
|
|
||||||
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
|
||||||
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
|
||||||
import kr.co.vividnext.sodalive.content.category.QCategoryContent.categoryContent
|
|
||||||
import org.springframework.stereotype.Repository
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) {
|
|
||||||
fun searchContentNotInCategory(
|
|
||||||
categoryId: Long,
|
|
||||||
searchWord: String,
|
|
||||||
memberId: Long
|
|
||||||
): List<SearchContentNotInCategoryResponse> {
|
|
||||||
return queryFactory
|
|
||||||
.select(QSearchContentNotInCategoryResponse(audioContent.id, audioContent.title))
|
|
||||||
.from(audioContent)
|
|
||||||
.leftJoin(categoryContent)
|
|
||||||
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(true)))
|
|
||||||
.where(
|
|
||||||
audioContent.duration.isNotNull
|
|
||||||
.and(audioContent.member.isNotNull)
|
|
||||||
.and(audioContent.member.id.eq(memberId))
|
|
||||||
.and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull))
|
|
||||||
.and(audioContent.title.contains(searchWord))
|
|
||||||
)
|
|
||||||
.fetch()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getContentInCategory(
|
|
||||||
categoryId: Long,
|
|
||||||
memberId: Long,
|
|
||||||
offset: Long,
|
|
||||||
limit: Long
|
|
||||||
): List<GetContentInCategoryResponse> {
|
|
||||||
return queryFactory
|
|
||||||
.select(QGetContentInCategoryResponse(audioContent.id, audioContent.title, audioContent.isAdult))
|
|
||||||
.from(audioContent)
|
|
||||||
.leftJoin(categoryContent)
|
|
||||||
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.isTrue))
|
|
||||||
.where(
|
|
||||||
audioContent.duration.isNotNull
|
|
||||||
.and(audioContent.member.isNotNull)
|
|
||||||
.and(audioContent.member.id.eq(memberId))
|
|
||||||
.and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull))
|
|
||||||
)
|
|
||||||
.fetch()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.creator.admin.content.category
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service
|
|
||||||
|
|
||||||
@Service
|
|
||||||
class CreatorAdminCategoryService(private val repository: CreatorAdminCategoryRepository) {
|
|
||||||
fun searchContentNotInCategory(
|
|
||||||
categoryId: Long,
|
|
||||||
searchWord: String,
|
|
||||||
memberId: Long
|
|
||||||
): List<SearchContentNotInCategoryResponse> {
|
|
||||||
return repository.searchContentNotInCategory(
|
|
||||||
categoryId,
|
|
||||||
searchWord,
|
|
||||||
memberId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getContentInCategory(
|
|
||||||
categoryId: Long,
|
|
||||||
memberId: Long,
|
|
||||||
offset: Long,
|
|
||||||
limit: Long
|
|
||||||
): List<GetContentInCategoryResponse> {
|
|
||||||
return repository.getContentInCategory(
|
|
||||||
categoryId,
|
|
||||||
memberId,
|
|
||||||
offset,
|
|
||||||
limit
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.creator.admin.content.category
|
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryProjection
|
|
||||||
|
|
||||||
data class GetContentInCategoryResponse @QueryProjection constructor(
|
|
||||||
val contentId: Long,
|
|
||||||
val title: String,
|
|
||||||
val isAdult: Boolean
|
|
||||||
)
|
|
|
@ -1,8 +0,0 @@
|
||||||
package kr.co.vividnext.sodalive.creator.admin.content.category
|
|
||||||
|
|
||||||
import com.querydsl.core.annotations.QueryProjection
|
|
||||||
|
|
||||||
data class SearchContentNotInCategoryResponse @QueryProjection constructor(
|
|
||||||
val contentId: Long,
|
|
||||||
val title: String
|
|
||||||
)
|
|
Loading…
Reference in New Issue