Compare commits
No commits in common. "229e7a8ccc0f3740dab1ad7282244854ab6d016d" and "3c616474ff34e7661abca1defbf8d72128ebe0d7" have entirely different histories.
229e7a8ccc
...
3c616474ff
|
@ -106,8 +106,6 @@ 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 {
|
||||||
|
@ -118,8 +116,6 @@ 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,20 +41,13 @@ 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(
|
fun findTotalCountByCreatorId(creatorId: Long, isAdult: Boolean = false, categoryId: Long = 0): Int
|
||||||
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,
|
||||||
|
@ -196,7 +189,6 @@ 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,
|
||||||
|
@ -217,20 +209,6 @@ 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
|
||||||
|
@ -295,8 +273,7 @@ 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(
|
||||||
|
@ -307,20 +284,6 @@ 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,25 +675,19 @@ 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 = isAdult,
|
isAdult = member.auth != null,
|
||||||
categoryId = categoryId,
|
categoryId = categoryId
|
||||||
contentType = contentType
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val audioContentList = repository.findByCreatorId(
|
val audioContentList = repository.findByCreatorId(
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
coverImageHost = coverImageHost,
|
coverImageHost = coverImageHost,
|
||||||
isAdult = isAdult,
|
isAdult = member.auth != null,
|
||||||
contentType = contentType,
|
|
||||||
sortType = sortType,
|
sortType = sortType,
|
||||||
categoryId = categoryId,
|
categoryId = categoryId,
|
||||||
offset = offset,
|
offset = offset,
|
||||||
|
|
|
@ -20,8 +20,6 @@ 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 {
|
||||||
|
@ -31,8 +29,6 @@ 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()
|
||||||
|
@ -43,19 +39,12 @@ 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(
|
service.getSeriesDetail(seriesId = id, member = member)
|
||||||
seriesId = id,
|
|
||||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
|
||||||
contentType = contentType ?: ContentType.ALL,
|
|
||||||
member = member
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +52,6 @@ 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 {
|
||||||
|
@ -73,8 +60,6 @@ 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,17 +22,16 @@ 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, contentType: ContentType): Int
|
fun getSeriesTotalCount(creatorId: Long, isAuth: Boolean): 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, contentType: ContentType): Series?
|
fun getSeriesDetail(seriesId: Long, isAuth: Boolean): 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>
|
||||||
|
@ -52,32 +51,17 @@ interface ContentSeriesQueryRepository {
|
||||||
class ContentSeriesQueryRepositoryImpl(
|
class ContentSeriesQueryRepositoryImpl(
|
||||||
private val queryFactory: JPAQueryFactory
|
private val queryFactory: JPAQueryFactory
|
||||||
) : ContentSeriesQueryRepository {
|
) : ContentSeriesQueryRepository {
|
||||||
override fun getSeriesTotalCount(creatorId: Long, isAuth: Boolean, contentType: ContentType): Int {
|
override fun getSeriesTotalCount(creatorId: Long, isAuth: Boolean): 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
|
||||||
|
@ -87,7 +71,6 @@ 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> {
|
||||||
|
@ -96,25 +79,10 @@ 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)
|
||||||
|
@ -122,31 +90,16 @@ class ContentSeriesQueryRepositoryImpl(
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSeriesDetail(seriesId: Long, isAuth: Boolean, contentType: ContentType): Series? {
|
override fun getSeriesDetail(seriesId: Long, isAuth: Boolean): 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, contentType)
|
return seriesToSeriesListItem(originalAudioDramaList, isAdult)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getGenreList(memberId: Long, isAdult: Boolean, contentType: ContentType): List<GetSeriesGenreListResponse> {
|
fun getGenreList(memberId: Long, isAdult: Boolean, contentType: ContentType): List<GetSeriesGenreListResponse> {
|
||||||
|
@ -51,43 +51,29 @@ 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 isAuth = member.auth != null && isAdultContentVisible
|
val totalCount = repository.getSeriesTotalCount(creatorId = creatorId, isAuth = member.auth != null)
|
||||||
|
|
||||||
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 = isAuth,
|
isAuth = member.auth != null,
|
||||||
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 = isAuth, contentType = contentType)
|
val items = seriesToSeriesListItem(seriesList = rawItems, isAdult = member.auth != null)
|
||||||
|
|
||||||
return GetSeriesListResponse(totalCount, items)
|
return GetSeriesListResponse(totalCount, items)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSeriesDetail(
|
fun getSeriesDetail(seriesId: Long, member: Member): GetSeriesDetailResponse {
|
||||||
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 && isAdultContentVisible,
|
isAuth = member.auth != null
|
||||||
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!!)
|
||||||
|
@ -111,8 +97,6 @@ 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,
|
||||||
|
@ -155,20 +139,17 @@ 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 && isAdultContentVisible
|
val isAdult = member.auth != null
|
||||||
|
|
||||||
val totalCount = seriesContentRepository.getContentCount(seriesId, isAdult = isAdult, contentType = contentType)
|
val totalCount = seriesContentRepository.getContentCount(seriesId, isAdult = isAdult)
|
||||||
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,
|
||||||
|
@ -199,14 +180,13 @@ 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 = isAuth,
|
isAuth = member.auth != null && isAdultContentVisible,
|
||||||
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 = isAuth, contentType = contentType)
|
return seriesToSeriesListItem(seriesList = seriesList, isAdult = member.auth != null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fetchSeriesByCurationId(
|
fun fetchSeriesByCurationId(
|
||||||
|
@ -221,13 +201,12 @@ class ContentSeriesService(
|
||||||
isAdult = isAdult,
|
isAdult = isAdult,
|
||||||
contentType = contentType
|
contentType = contentType
|
||||||
)
|
)
|
||||||
return seriesToSeriesListItem(seriesList, isAdult, contentType)
|
return seriesToSeriesListItem(seriesList, isAdult)
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -247,8 +226,7 @@ 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,24 +2,21 @@ 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, contentType: ContentType): Int
|
fun getContentCount(seriesId: Long, isAdult: Boolean): 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,
|
||||||
|
@ -32,33 +29,18 @@ interface ContentSeriesContentQueryRepository {
|
||||||
class ContentSeriesContentQueryRepositoryImpl(
|
class ContentSeriesContentQueryRepositoryImpl(
|
||||||
private val queryFactory: JPAQueryFactory
|
private val queryFactory: JPAQueryFactory
|
||||||
) : ContentSeriesContentQueryRepository {
|
) : ContentSeriesContentQueryRepository {
|
||||||
override fun getContentCount(seriesId: Long, isAdult: Boolean, contentType: ContentType): Int {
|
override fun getContentCount(seriesId: Long, isAdult: Boolean): 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()
|
||||||
|
@ -68,7 +50,6 @@ 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,
|
||||||
|
@ -86,20 +67,6 @@ 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(
|
||||||
|
@ -129,7 +96,6 @@ 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,18 +52,10 @@ 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(
|
ApiResponse.ok(service.getCreatorProfile(creatorId, timezone, member))
|
||||||
service.getCreatorProfile(
|
|
||||||
creatorId = creatorId,
|
|
||||||
timezone = timezone,
|
|
||||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
|
||||||
member = member
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/profile/{id}/donation-rank")
|
@GetMapping("/profile/{id}/donation-rank")
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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
|
||||||
|
@ -165,12 +164,7 @@ class ExplorerService(
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCreatorProfile(
|
fun getCreatorProfile(creatorId: Long, timezone: String, member: Member): GetCreatorProfileResponse {
|
||||||
creatorId: Long,
|
|
||||||
timezone: String,
|
|
||||||
isAdultContentVisible: Boolean,
|
|
||||||
member: Member
|
|
||||||
): GetCreatorProfileResponse {
|
|
||||||
// 크리에이터(유저) 정보
|
// 크리에이터(유저) 정보
|
||||||
val creatorAccount = queryRepository.getMember(creatorId) ?: throw SodaException("없는 사용자 입니다.")
|
val creatorAccount = queryRepository.getMember(creatorId) ?: throw SodaException("없는 사용자 입니다.")
|
||||||
|
|
||||||
|
@ -221,8 +215,6 @@ 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
|
||||||
|
@ -276,12 +268,7 @@ class ExplorerService(
|
||||||
|
|
||||||
val seriesList = if (isCreator) {
|
val seriesList = if (isCreator) {
|
||||||
seriesService
|
seriesService
|
||||||
.getSeriesList(
|
.getSeriesList(creatorId = creatorId, member = member)
|
||||||
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, contentType = contentType)
|
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSeriesAllRankingByGenre(
|
fun getSeriesAllRankingByGenre(
|
||||||
|
@ -106,7 +106,7 @@ class RankingService(
|
||||||
contentType = contentType,
|
contentType = contentType,
|
||||||
genreId = genreId
|
genreId = genreId
|
||||||
)
|
)
|
||||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult, contentType = contentType)
|
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCompleteSeriesRankingTotalCount(
|
fun getCompleteSeriesRankingTotalCount(
|
||||||
|
@ -139,13 +139,12 @@ class RankingService(
|
||||||
offset = offset,
|
offset = offset,
|
||||||
limit = limit
|
limit = limit
|
||||||
)
|
)
|
||||||
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult, contentType = contentType)
|
return seriesToSeriesListItem(seriesList = seriesList, isAdult = isAdult)
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -165,8 +164,7 @@ 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
|
||||||
|
@ -256,7 +254,7 @@ class RankingService(
|
||||||
isAdult = isAdult,
|
isAdult = isAdult,
|
||||||
contentType = contentType
|
contentType = contentType
|
||||||
)
|
)
|
||||||
return seriesToSeriesListItem(seriesList, isAdult, contentType = contentType)
|
return seriesToSeriesListItem(seriesList, isAdult)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fetchFreeContentByCreatorIdTop4(
|
fun fetchFreeContentByCreatorIdTop4(
|
||||||
|
|
Loading…
Reference in New Issue