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