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