feat(series): 완결된 시리즈를 조회할 수 있도록 isCompleted 파라미터 추가
This commit is contained in:
@@ -20,6 +20,7 @@ class ContentSeriesController(private val service: ContentSeriesService) {
|
|||||||
fun getSeriesList(
|
fun getSeriesList(
|
||||||
@RequestParam(required = false) creatorId: Long?,
|
@RequestParam(required = false) creatorId: Long?,
|
||||||
@RequestParam(name = "isOriginal", required = false) isOriginal: Boolean? = null,
|
@RequestParam(name = "isOriginal", required = false) isOriginal: Boolean? = null,
|
||||||
|
@RequestParam(name = "isCompleted", required = false) isCompleted: Boolean? = null,
|
||||||
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
|
||||||
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
@RequestParam("contentType", required = false) contentType: ContentType? = null,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||||
@@ -31,6 +32,7 @@ class ContentSeriesController(private val service: ContentSeriesService) {
|
|||||||
service.getSeriesList(
|
service.getSeriesList(
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
isOriginal = isOriginal ?: false,
|
isOriginal = isOriginal ?: false,
|
||||||
|
isCompleted = isCompleted ?: false,
|
||||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||||
contentType = contentType ?: ContentType.ALL,
|
contentType = contentType ?: ContentType.ALL,
|
||||||
member = member,
|
member = member,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ 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.Series
|
import kr.co.vividnext.sodalive.creator.admin.content.series.Series
|
||||||
import kr.co.vividnext.sodalive.creator.admin.content.series.SeriesPublishedDaysOfWeek
|
import kr.co.vividnext.sodalive.creator.admin.content.series.SeriesPublishedDaysOfWeek
|
||||||
|
import kr.co.vividnext.sodalive.creator.admin.content.series.SeriesState
|
||||||
import kr.co.vividnext.sodalive.creator.admin.content.series.keyword.QSeriesKeyword.seriesKeyword
|
import kr.co.vividnext.sodalive.creator.admin.content.series.keyword.QSeriesKeyword.seriesKeyword
|
||||||
import kr.co.vividnext.sodalive.member.MemberRole
|
import kr.co.vividnext.sodalive.member.MemberRole
|
||||||
import kr.co.vividnext.sodalive.member.QMember.member
|
import kr.co.vividnext.sodalive.member.QMember.member
|
||||||
@@ -23,13 +24,21 @@ 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, isOriginal: Boolean): Int
|
fun getSeriesTotalCount(
|
||||||
|
creatorId: Long?,
|
||||||
|
isAuth: Boolean,
|
||||||
|
contentType: ContentType,
|
||||||
|
isOriginal: Boolean,
|
||||||
|
isCompleted: Boolean
|
||||||
|
): Int
|
||||||
|
|
||||||
fun getSeriesList(
|
fun getSeriesList(
|
||||||
imageHost: String,
|
imageHost: String,
|
||||||
creatorId: Long?,
|
creatorId: Long?,
|
||||||
isAuth: Boolean,
|
isAuth: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
isOriginal: Boolean,
|
isOriginal: Boolean,
|
||||||
|
isCompleted: Boolean,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long
|
limit: Long
|
||||||
): List<Series>
|
): List<Series>
|
||||||
@@ -60,7 +69,13 @@ 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, isOriginal: Boolean): Int {
|
override fun getSeriesTotalCount(
|
||||||
|
creatorId: Long?,
|
||||||
|
isAuth: Boolean,
|
||||||
|
contentType: ContentType,
|
||||||
|
isOriginal: Boolean,
|
||||||
|
isCompleted: Boolean
|
||||||
|
): Int {
|
||||||
var where = series.isActive.isTrue
|
var where = series.isActive.isTrue
|
||||||
|
|
||||||
if (creatorId != null) {
|
if (creatorId != null) {
|
||||||
@@ -71,6 +86,10 @@ class ContentSeriesQueryRepositoryImpl(
|
|||||||
where = where.and(series.isOriginal.isTrue)
|
where = where.and(series.isOriginal.isTrue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCompleted) {
|
||||||
|
where = where.and(series.state.eq(SeriesState.COMPLETE))
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAuth) {
|
if (!isAuth) {
|
||||||
where = where.and(series.isAdult.isFalse)
|
where = where.and(series.isAdult.isFalse)
|
||||||
} else {
|
} else {
|
||||||
@@ -104,6 +123,7 @@ class ContentSeriesQueryRepositoryImpl(
|
|||||||
isAuth: Boolean,
|
isAuth: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
isOriginal: Boolean,
|
isOriginal: Boolean,
|
||||||
|
isCompleted: Boolean,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long
|
limit: Long
|
||||||
): List<Series> {
|
): List<Series> {
|
||||||
@@ -116,6 +136,10 @@ class ContentSeriesQueryRepositoryImpl(
|
|||||||
where = where.and(series.isOriginal.isTrue)
|
where = where.and(series.isOriginal.isTrue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCompleted) {
|
||||||
|
where = where.and(series.state.eq(SeriesState.COMPLETE))
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAuth) {
|
if (!isAuth) {
|
||||||
where = where.and(series.isAdult.isFalse)
|
where = where.and(series.isAdult.isFalse)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -51,11 +51,12 @@ class ContentSeriesService(
|
|||||||
fun getSeriesList(
|
fun getSeriesList(
|
||||||
creatorId: Long?,
|
creatorId: Long?,
|
||||||
isOriginal: Boolean = false,
|
isOriginal: Boolean = false,
|
||||||
|
isCompleted: Boolean = false,
|
||||||
isAdultContentVisible: Boolean,
|
isAdultContentVisible: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
member: Member,
|
member: Member,
|
||||||
offset: Long = 0,
|
offset: Long = 0,
|
||||||
limit: Long = 10
|
limit: Long = 20
|
||||||
): GetSeriesListResponse {
|
): GetSeriesListResponse {
|
||||||
val isAuth = member.auth != null && isAdultContentVisible
|
val isAuth = member.auth != null && isAdultContentVisible
|
||||||
|
|
||||||
@@ -63,7 +64,8 @@ class ContentSeriesService(
|
|||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
isAuth = isAuth,
|
isAuth = isAuth,
|
||||||
contentType = contentType,
|
contentType = contentType,
|
||||||
isOriginal = isOriginal
|
isOriginal = isOriginal,
|
||||||
|
isCompleted = isCompleted
|
||||||
)
|
)
|
||||||
|
|
||||||
val rawItems = repository.getSeriesList(
|
val rawItems = repository.getSeriesList(
|
||||||
@@ -72,6 +74,7 @@ class ContentSeriesService(
|
|||||||
isAuth = isAuth,
|
isAuth = isAuth,
|
||||||
contentType = contentType,
|
contentType = contentType,
|
||||||
isOriginal = isOriginal,
|
isOriginal = isOriginal,
|
||||||
|
isCompleted = isCompleted,
|
||||||
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!!) }
|
||||||
|
|||||||
Reference in New Issue
Block a user