크리에이터 관리자 카테고리 콘텐츠 리스트 API

- 커버이미지 추가
This commit is contained in:
Klaus 2024-02-07 04:15:01 +09:00
parent e76eed7274
commit db0e526896
3 changed files with 19 additions and 3 deletions

View File

@ -45,13 +45,21 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory)
}
fun getContentInCategory(
imageHost: String,
categoryId: Long,
memberId: Long,
offset: Long,
limit: Long
): List<GetContentInCategoryItem> {
return queryFactory
.select(QGetContentInCategoryItem(audioContent.id, audioContent.title, audioContent.isAdult))
.select(
QGetContentInCategoryItem(
audioContent.id,
audioContent.title,
audioContent.isAdult,
audioContent.coverImage.prepend("/").prepend(imageHost)
)
)
.from(audioContent)
.leftJoin(categoryContent)
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.isTrue))

View File

@ -1,9 +1,15 @@
package kr.co.vividnext.sodalive.creator.admin.content.category
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
@Service
class CreatorAdminCategoryService(private val repository: CreatorAdminCategoryRepository) {
class CreatorAdminCategoryService(
private val repository: CreatorAdminCategoryRepository,
@Value("\${cloud.aws.cloud-front.host}")
private val imageHost: String
) {
fun searchContentNotInCategory(
categoryId: Long,
searchWord: String,
@ -24,6 +30,7 @@ class CreatorAdminCategoryService(private val repository: CreatorAdminCategoryRe
): GetContentInCategoryResponse {
val totalCount = repository.getContentInCategoryTotalCount(categoryId, memberId)
val items = repository.getContentInCategory(
imageHost,
categoryId,
memberId,
offset,

View File

@ -10,5 +10,6 @@ data class GetContentInCategoryResponse(
data class GetContentInCategoryItem @QueryProjection constructor(
val contentId: Long,
val title: String,
val isAdult: Boolean
val isAdult: Boolean,
val image: String
)