시리즈 상세, 채널 상세 #291
|
@ -106,6 +106,8 @@ class AudioContentController(private val service: AudioContentService) {
|
|||
@RequestParam("creator-id") creatorId: Long,
|
||||
@RequestParam("sort-type", required = false) sortType: SortType? = SortType.NEWEST,
|
||||
@RequestParam("category-id", required = false) categoryId: Long? = 0,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
pageable: Pageable
|
||||
) = run {
|
||||
|
@ -116,6 +118,8 @@ class AudioContentController(private val service: AudioContentService) {
|
|||
creatorId = creatorId,
|
||||
sortType = sortType ?: SortType.NEWEST,
|
||||
categoryId = categoryId ?: 0,
|
||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
member = member,
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize.toLong()
|
||||
|
|
|
@ -41,13 +41,20 @@ interface AudioContentQueryRepository {
|
|||
creatorId: Long,
|
||||
coverImageHost: String,
|
||||
isAdult: Boolean = false,
|
||||
contentType: ContentType = ContentType.ALL,
|
||||
sortType: SortType = SortType.NEWEST,
|
||||
categoryId: Long = 0,
|
||||
offset: Long = 0,
|
||||
limit: Long = 10
|
||||
): List<GetAudioContentListItem>
|
||||
|
||||
fun findTotalCountByCreatorId(creatorId: Long, isAdult: Boolean = false, categoryId: Long = 0): Int
|
||||
fun findTotalCountByCreatorId(
|
||||
creatorId: Long,
|
||||
isAdult: Boolean = false,
|
||||
categoryId: Long = 0,
|
||||
contentType: ContentType = ContentType.ALL
|
||||
): Int
|
||||
|
||||
fun getCreatorOtherContentList(
|
||||
cloudfrontHost: String,
|
||||
contentId: Long,
|
||||
|
@ -189,6 +196,7 @@ class AudioContentQueryRepositoryImpl(
|
|||
creatorId: Long,
|
||||
coverImageHost: String,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
sortType: SortType,
|
||||
categoryId: Long,
|
||||
offset: Long,
|
||||
|
@ -209,6 +217,20 @@ class AudioContentQueryRepositoryImpl(
|
|||
|
||||
if (!isAdult) {
|
||||
where = where.and(audioContent.isAdult.isFalse)
|
||||
} else {
|
||||
if (contentType != ContentType.ALL) {
|
||||
where = where.and(
|
||||
audioContent.member.isNull.or(
|
||||
audioContent.member.auth.gender.eq(
|
||||
if (contentType == ContentType.MALE) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
var select = queryFactory
|
||||
|
@ -273,7 +295,8 @@ class AudioContentQueryRepositoryImpl(
|
|||
override fun findTotalCountByCreatorId(
|
||||
creatorId: Long,
|
||||
isAdult: Boolean,
|
||||
categoryId: Long
|
||||
categoryId: Long,
|
||||
contentType: ContentType
|
||||
): Int {
|
||||
var where = audioContent.member.id.eq(creatorId)
|
||||
.and(
|
||||
|
@ -284,6 +307,20 @@ class AudioContentQueryRepositoryImpl(
|
|||
|
||||
if (!isAdult) {
|
||||
where = where.and(audioContent.isAdult.isFalse)
|
||||
} else {
|
||||
if (contentType != ContentType.ALL) {
|
||||
where = where.and(
|
||||
audioContent.member.isNull.or(
|
||||
audioContent.member.auth.gender.eq(
|
||||
if (contentType == ContentType.MALE) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
var select = queryFactory
|
||||
|
|
|
@ -675,19 +675,25 @@ class AudioContentService(
|
|||
sortType: SortType,
|
||||
member: Member,
|
||||
categoryId: Long = 0,
|
||||
isAdultContentVisible: Boolean,
|
||||
contentType: ContentType,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): GetAudioContentListResponse {
|
||||
val isAdult = member.auth != null && isAdultContentVisible
|
||||
|
||||
val totalCount = repository.findTotalCountByCreatorId(
|
||||
creatorId = creatorId,
|
||||
isAdult = member.auth != null,
|
||||
categoryId = categoryId
|
||||
isAdult = isAdult,
|
||||
categoryId = categoryId,
|
||||
contentType = contentType
|
||||
)
|
||||
|
||||
val audioContentList = repository.findByCreatorId(
|
||||
creatorId = creatorId,
|
||||
coverImageHost = coverImageHost,
|
||||
isAdult = member.auth != null,
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
sortType = sortType,
|
||||
categoryId = categoryId,
|
||||
offset = offset,
|
||||
|
|
|
@ -20,6 +20,8 @@ class ContentSeriesController(private val service: ContentSeriesService) {
|
|||
fun getSeriesList(
|
||||
@RequestParam creatorId: Long,
|
||||
@RequestParam("sortType", required = false) sortType: SeriesSortType? = SeriesSortType.NEWEST,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
pageable: Pageable
|
||||
) = run {
|
||||
|
@ -29,6 +31,8 @@ class ContentSeriesController(private val service: ContentSeriesService) {
|
|||
service.getSeriesList(
|
||||
creatorId = creatorId,
|
||||
sortType = sortType ?: SeriesSortType.NEWEST,
|
||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
member = member,
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize.toLong()
|
||||
|
@ -39,12 +43,19 @@ class ContentSeriesController(private val service: ContentSeriesService) {
|
|||
@GetMapping("/{id}")
|
||||
fun getSeriesDetail(
|
||||
@PathVariable id: Long,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.getSeriesDetail(seriesId = id, member = member)
|
||||
service.getSeriesDetail(
|
||||
seriesId = id,
|
||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
member = member
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -52,6 +63,8 @@ class ContentSeriesController(private val service: ContentSeriesService) {
|
|||
fun getSeriesContentList(
|
||||
@PathVariable id: Long,
|
||||
@RequestParam("sortType", required = false) sortType: SeriesSortType? = SeriesSortType.NEWEST,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||
pageable: Pageable
|
||||
) = run {
|
||||
|
@ -60,6 +73,8 @@ class ContentSeriesController(private val service: ContentSeriesService) {
|
|||
ApiResponse.ok(
|
||||
service.getSeriesContentList(
|
||||
seriesId = id,
|
||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||
contentType = contentType ?: ContentType.ALL,
|
||||
member = member,
|
||||
sortType = sortType ?: SeriesSortType.NEWEST,
|
||||
offset = pageable.offset,
|
||||
|
|
|
@ -22,16 +22,17 @@ import org.springframework.data.jpa.repository.JpaRepository
|
|||
interface ContentSeriesRepository : JpaRepository<Series, Long>, ContentSeriesQueryRepository
|
||||
|
||||
interface ContentSeriesQueryRepository {
|
||||
fun getSeriesTotalCount(creatorId: Long, isAuth: Boolean): Int
|
||||
fun getSeriesTotalCount(creatorId: Long, isAuth: Boolean, contentType: ContentType): Int
|
||||
fun getSeriesList(
|
||||
imageHost: String,
|
||||
creatorId: Long,
|
||||
isAuth: Boolean,
|
||||
contentType: ContentType,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): List<Series>
|
||||
|
||||
fun getSeriesDetail(seriesId: Long, isAuth: Boolean): Series?
|
||||
fun getSeriesDetail(seriesId: Long, isAuth: Boolean, contentType: ContentType): Series?
|
||||
fun getKeywordList(seriesId: Long): List<String>
|
||||
fun getSeriesContentMinMaxPrice(seriesId: Long): GetSeriesContentMinMaxPriceResponse
|
||||
fun getRecommendSeriesList(isAuth: Boolean, contentType: ContentType, limit: Long): List<Series>
|
||||
|
@ -51,17 +52,32 @@ interface ContentSeriesQueryRepository {
|
|||
class ContentSeriesQueryRepositoryImpl(
|
||||
private val queryFactory: JPAQueryFactory
|
||||
) : ContentSeriesQueryRepository {
|
||||
override fun getSeriesTotalCount(creatorId: Long, isAuth: Boolean): Int {
|
||||
override fun getSeriesTotalCount(creatorId: Long, isAuth: Boolean, contentType: ContentType): Int {
|
||||
var where = series.member.id.eq(creatorId)
|
||||
.and(series.isActive.isTrue)
|
||||
|
||||
if (!isAuth) {
|
||||
where = where.and(series.isAdult.isFalse)
|
||||
} else {
|
||||
if (contentType != ContentType.ALL) {
|
||||
where = where.and(
|
||||
series.member.isNull.or(
|
||||
series.member.auth.gender.eq(
|
||||
if (contentType == ContentType.MALE) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(series.id)
|
||||
.from(series)
|
||||
.innerJoin(series.member, member)
|
||||
.where(where)
|
||||
.fetch()
|
||||
.size
|
||||
|
@ -71,6 +87,7 @@ class ContentSeriesQueryRepositoryImpl(
|
|||
imageHost: String,
|
||||
creatorId: Long,
|
||||
isAuth: Boolean,
|
||||
contentType: ContentType,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): List<Series> {
|
||||
|
@ -79,10 +96,25 @@ class ContentSeriesQueryRepositoryImpl(
|
|||
|
||||
if (!isAuth) {
|
||||
where = where.and(series.isAdult.isFalse)
|
||||
} else {
|
||||
if (contentType != ContentType.ALL) {
|
||||
where = where.and(
|
||||
series.member.isNull.or(
|
||||
series.member.auth.gender.eq(
|
||||
if (contentType == ContentType.MALE) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.selectFrom(series)
|
||||
.innerJoin(series.member, member)
|
||||
.where(where)
|
||||
.orderBy(series.orders.asc(), series.createdAt.asc())
|
||||
.offset(offset)
|
||||
|
@ -90,16 +122,31 @@ class ContentSeriesQueryRepositoryImpl(
|
|||
.fetch()
|
||||
}
|
||||
|
||||
override fun getSeriesDetail(seriesId: Long, isAuth: Boolean): Series? {
|
||||
override fun getSeriesDetail(seriesId: Long, isAuth: Boolean, contentType: ContentType): Series? {
|
||||
var where = series.id.eq(seriesId)
|
||||
.and(series.isActive.isTrue)
|
||||
|
||||
if (!isAuth) {
|
||||
where = where.and(series.isAdult.isFalse)
|
||||
} else {
|
||||
if (contentType != ContentType.ALL) {
|
||||
where = where.and(
|
||||
series.member.isNull.or(
|
||||
series.member.auth.gender.eq(
|
||||
if (contentType == ContentType.MALE) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.selectFrom(series)
|
||||
.innerJoin(series.member, member)
|
||||
.where(where)
|
||||
.fetchFirst()
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class ContentSeriesService(
|
|||
limit: Long = 20
|
||||
): List<GetSeriesListResponse.SeriesListItem> {
|
||||
val originalAudioDramaList = repository.getOriginalAudioDramaList(memberId, isAdult, contentType, offset, limit)
|
||||
return seriesToSeriesListItem(originalAudioDramaList, isAdult)
|
||||
return seriesToSeriesListItem(originalAudioDramaList, isAdult, contentType)
|
||||
}
|
||||
|
||||
fun getGenreList(memberId: Long, isAdult: Boolean, contentType: ContentType): List<GetSeriesGenreListResponse> {
|
||||
|
@ -51,29 +51,43 @@ class ContentSeriesService(
|
|||
|
||||
fun getSeriesList(
|
||||
creatorId: Long,
|
||||
isAdultContentVisible: Boolean,
|
||||
contentType: ContentType,
|
||||
member: Member,
|
||||
sortType: SeriesSortType = SeriesSortType.NEWEST,
|
||||
offset: Long = 0,
|
||||
limit: Long = 10
|
||||
): GetSeriesListResponse {
|
||||
val totalCount = repository.getSeriesTotalCount(creatorId = creatorId, isAuth = member.auth != null)
|
||||
val isAuth = member.auth != null && isAdultContentVisible
|
||||
|
||||
val totalCount = repository.getSeriesTotalCount(
|
||||
creatorId = creatorId,
|
||||
isAuth = isAuth,
|
||||
contentType = contentType
|
||||
)
|
||||
val rawItems = repository.getSeriesList(
|
||||
imageHost = coverImageHost,
|
||||
creatorId = creatorId,
|
||||
isAuth = member.auth != null,
|
||||
isAuth = isAuth,
|
||||
contentType = contentType,
|
||||
offset = offset,
|
||||
limit = limit
|
||||
).filter { !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.member!!.id!!) }
|
||||
|
||||
val items = seriesToSeriesListItem(seriesList = rawItems, isAdult = member.auth != null)
|
||||
|
||||
val items = seriesToSeriesListItem(seriesList = rawItems, isAdult = isAuth, contentType = contentType)
|
||||
return GetSeriesListResponse(totalCount, items)
|
||||
}
|
||||
|
||||
fun getSeriesDetail(seriesId: Long, member: Member): GetSeriesDetailResponse {
|
||||
fun getSeriesDetail(
|
||||
seriesId: Long,
|
||||
isAdultContentVisible: Boolean,
|
||||
contentType: ContentType,
|
||||
member: Member
|
||||
): GetSeriesDetailResponse {
|
||||
val series = repository.getSeriesDetail(
|
||||
seriesId = seriesId,
|
||||
isAuth = member.auth != null
|
||||
isAuth = member.auth != null && isAdultContentVisible,
|
||||
contentType = contentType
|
||||
) ?: throw SodaException("잘못된 시리즈 입니다.\n다시 시도해 주세요")
|
||||
|
||||
val isBlocked = blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = series.member!!.id!!)
|
||||
|
@ -97,6 +111,8 @@ class ContentSeriesService(
|
|||
|
||||
val seriesContentList = getSeriesContentList(
|
||||
seriesId = seriesId,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = contentType,
|
||||
member = member,
|
||||
sortType = SeriesSortType.NEWEST,
|
||||
offset = 0,
|
||||
|
@ -139,17 +155,20 @@ class ContentSeriesService(
|
|||
|
||||
fun getSeriesContentList(
|
||||
seriesId: Long,
|
||||
isAdultContentVisible: Boolean,
|
||||
contentType: ContentType,
|
||||
member: Member,
|
||||
sortType: SeriesSortType,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): GetSeriesContentListResponse {
|
||||
val isAdult = member.auth != null
|
||||
val isAdult = member.auth != null && isAdultContentVisible
|
||||
|
||||
val totalCount = seriesContentRepository.getContentCount(seriesId, isAdult = isAdult)
|
||||
val totalCount = seriesContentRepository.getContentCount(seriesId, isAdult = isAdult, contentType = contentType)
|
||||
val contentList = seriesContentRepository.getContentList(
|
||||
seriesId = seriesId,
|
||||
isAdult = isAdult,
|
||||
contentType = contentType,
|
||||
imageHost = coverImageHost,
|
||||
sortType = sortType,
|
||||
offset = offset,
|
||||
|
@ -180,13 +199,14 @@ class ContentSeriesService(
|
|||
contentType: ContentType,
|
||||
member: Member
|
||||
): List<GetSeriesListResponse.SeriesListItem> {
|
||||
val isAuth = member.auth != null && isAdultContentVisible
|
||||
val seriesList = repository.getRecommendSeriesList(
|
||||
isAuth = member.auth != null && isAdultContentVisible,
|
||||
isAuth = isAuth,
|
||||
contentType = contentType,
|
||||
limit = 10
|
||||
).filter { !blockMemberRepository.isBlocked(blockedMemberId = member.id!!, memberId = it.member!!.id!!) }
|
||||
|
||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = member.auth != null)
|
||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAuth, contentType = contentType)
|
||||
}
|
||||
|
||||
fun fetchSeriesByCurationId(
|
||||
|
@ -201,12 +221,13 @@ class ContentSeriesService(
|
|||
isAdult = isAdult,
|
||||
contentType = contentType
|
||||
)
|
||||
return seriesToSeriesListItem(seriesList, isAdult)
|
||||
return seriesToSeriesListItem(seriesList, isAdult, contentType)
|
||||
}
|
||||
|
||||
private fun seriesToSeriesListItem(
|
||||
seriesList: List<Series>,
|
||||
isAdult: Boolean
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType
|
||||
): List<GetSeriesListResponse.SeriesListItem> {
|
||||
return seriesList
|
||||
.map {
|
||||
|
@ -226,7 +247,8 @@ class ContentSeriesService(
|
|||
.map {
|
||||
it.numberOfContent = seriesContentRepository.getContentCount(
|
||||
seriesId = it.seriesId,
|
||||
isAdult = isAdult
|
||||
isAdult = isAdult,
|
||||
contentType = contentType
|
||||
)
|
||||
|
||||
it
|
||||
|
|
|
@ -2,21 +2,24 @@ package kr.co.vividnext.sodalive.content.series.content
|
|||
|
||||
import com.querydsl.core.types.dsl.Expressions
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import kr.co.vividnext.sodalive.content.ContentType
|
||||
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.QSeries.series
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.QSeriesContent.seriesContent
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.SeriesContent
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.SeriesSortType
|
||||
import kr.co.vividnext.sodalive.member.QMember.member
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import java.time.LocalDateTime
|
||||
|
||||
interface ContentSeriesContentRepository : JpaRepository<SeriesContent, Long>, ContentSeriesContentQueryRepository
|
||||
|
||||
interface ContentSeriesContentQueryRepository {
|
||||
fun getContentCount(seriesId: Long, isAdult: Boolean): Int
|
||||
fun getContentCount(seriesId: Long, isAdult: Boolean, contentType: ContentType): Int
|
||||
fun getContentList(
|
||||
seriesId: Long,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
imageHost: String,
|
||||
sortType: SeriesSortType,
|
||||
offset: Long,
|
||||
|
@ -29,18 +32,33 @@ interface ContentSeriesContentQueryRepository {
|
|||
class ContentSeriesContentQueryRepositoryImpl(
|
||||
private val queryFactory: JPAQueryFactory
|
||||
) : ContentSeriesContentQueryRepository {
|
||||
override fun getContentCount(seriesId: Long, isAdult: Boolean): Int {
|
||||
override fun getContentCount(seriesId: Long, isAdult: Boolean, contentType: ContentType): Int {
|
||||
var where = seriesContent.series.id.eq(seriesId)
|
||||
.and(seriesContent.content.isActive.isTrue)
|
||||
|
||||
if (!isAdult) {
|
||||
where = where.and(seriesContent.content.isAdult.isFalse)
|
||||
} else {
|
||||
if (contentType != ContentType.ALL) {
|
||||
where = where.and(
|
||||
series.member.isNull.or(
|
||||
series.member.auth.gender.eq(
|
||||
if (contentType == ContentType.MALE) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(seriesContent.id)
|
||||
.from(seriesContent)
|
||||
.innerJoin(seriesContent.series, series)
|
||||
.innerJoin(series.member, member)
|
||||
.innerJoin(seriesContent.content, audioContent)
|
||||
.where(where)
|
||||
.fetch()
|
||||
|
@ -50,6 +68,7 @@ class ContentSeriesContentQueryRepositoryImpl(
|
|||
override fun getContentList(
|
||||
seriesId: Long,
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType,
|
||||
imageHost: String,
|
||||
sortType: SeriesSortType,
|
||||
offset: Long,
|
||||
|
@ -67,6 +86,20 @@ class ContentSeriesContentQueryRepositoryImpl(
|
|||
|
||||
if (!isAdult) {
|
||||
where = where.and(audioContent.isAdult.isFalse)
|
||||
} else {
|
||||
if (contentType != ContentType.ALL) {
|
||||
where = where.and(
|
||||
series.member.isNull.or(
|
||||
series.member.auth.gender.eq(
|
||||
if (contentType == ContentType.MALE) {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val formattedDate = Expressions.stringTemplate(
|
||||
|
@ -96,6 +129,7 @@ class ContentSeriesContentQueryRepositoryImpl(
|
|||
)
|
||||
.from(seriesContent)
|
||||
.innerJoin(seriesContent.series, series)
|
||||
.innerJoin(series.member, member)
|
||||
.innerJoin(seriesContent.content, audioContent)
|
||||
.where(where)
|
||||
.orderBy(*sortOrders.toTypedArray())
|
||||
|
|
|
@ -52,10 +52,18 @@ class ExplorerController(private val service: ExplorerService) {
|
|||
fun getCreatorProfile(
|
||||
@PathVariable("id") creatorId: Long,
|
||||
@RequestParam timezone: String,
|
||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
ApiResponse.ok(service.getCreatorProfile(creatorId, timezone, member))
|
||||
ApiResponse.ok(
|
||||
service.getCreatorProfile(
|
||||
creatorId = creatorId,
|
||||
timezone = timezone,
|
||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||
member = member
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@GetMapping("/profile/{id}/donation-rank")
|
||||
|
|
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.explorer
|
|||
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.content.AudioContentService
|
||||
import kr.co.vividnext.sodalive.content.ContentType
|
||||
import kr.co.vividnext.sodalive.content.SortType
|
||||
import kr.co.vividnext.sodalive.content.series.ContentSeriesService
|
||||
import kr.co.vividnext.sodalive.explorer.follower.GetFollowerListResponse
|
||||
|
@ -164,7 +165,12 @@ class ExplorerService(
|
|||
.toList()
|
||||
}
|
||||
|
||||
fun getCreatorProfile(creatorId: Long, timezone: String, member: Member): GetCreatorProfileResponse {
|
||||
fun getCreatorProfile(
|
||||
creatorId: Long,
|
||||
timezone: String,
|
||||
isAdultContentVisible: Boolean,
|
||||
member: Member
|
||||
): GetCreatorProfileResponse {
|
||||
// 크리에이터(유저) 정보
|
||||
val creatorAccount = queryRepository.getMember(creatorId) ?: throw SodaException("없는 사용자 입니다.")
|
||||
|
||||
|
@ -215,6 +221,8 @@ class ExplorerService(
|
|||
audioContentService.getAudioContentList(
|
||||
creatorId = creatorId,
|
||||
sortType = SortType.NEWEST,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = ContentType.ALL,
|
||||
member = member,
|
||||
offset = 0,
|
||||
limit = 3
|
||||
|
@ -268,7 +276,12 @@ class ExplorerService(
|
|||
|
||||
val seriesList = if (isCreator) {
|
||||
seriesService
|
||||
.getSeriesList(creatorId = creatorId, member = member)
|
||||
.getSeriesList(
|
||||
creatorId = creatorId,
|
||||
isAdultContentVisible = isAdultContentVisible,
|
||||
contentType = ContentType.ALL,
|
||||
member = member
|
||||
)
|
||||
.items
|
||||
} else {
|
||||
listOf()
|
||||
|
|
|
@ -91,7 +91,7 @@ class RankingService(
|
|||
loopCount++
|
||||
} while (seriesList.size < 5 && loopCount < 5)
|
||||
|
||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
|
||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult, contentType = contentType)
|
||||
}
|
||||
|
||||
fun getSeriesAllRankingByGenre(
|
||||
|
@ -106,7 +106,7 @@ class RankingService(
|
|||
contentType = contentType,
|
||||
genreId = genreId
|
||||
)
|
||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
|
||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult, contentType = contentType)
|
||||
}
|
||||
|
||||
fun getCompleteSeriesRankingTotalCount(
|
||||
|
@ -139,12 +139,13 @@ class RankingService(
|
|||
offset = offset,
|
||||
limit = limit
|
||||
)
|
||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
|
||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult, contentType = contentType)
|
||||
}
|
||||
|
||||
private fun seriesToSeriesListItem(
|
||||
seriesList: List<Series>,
|
||||
isAdult: Boolean
|
||||
isAdult: Boolean,
|
||||
contentType: ContentType
|
||||
): List<GetSeriesListResponse.SeriesListItem> {
|
||||
return seriesList
|
||||
.map {
|
||||
|
@ -164,7 +165,8 @@ class RankingService(
|
|||
.map {
|
||||
it.numberOfContent = seriesContentRepository.getContentCount(
|
||||
seriesId = it.seriesId,
|
||||
isAdult = isAdult
|
||||
isAdult = isAdult,
|
||||
contentType = contentType
|
||||
)
|
||||
|
||||
it
|
||||
|
@ -254,7 +256,7 @@ class RankingService(
|
|||
isAdult = isAdult,
|
||||
contentType = contentType
|
||||
)
|
||||
return seriesToSeriesListItem(seriesList, isAdult)
|
||||
return seriesToSeriesListItem(seriesList, isAdult, contentType = contentType)
|
||||
}
|
||||
|
||||
fun fetchFreeContentByCreatorIdTop4(
|
||||
|
|
Loading…
Reference in New Issue