feat(series): 오직 보이스온에서만(오리지널) 제공하는 콘텐츠도 조회할 수 있도록 isOriginal 파라미터 추가
This commit is contained in:
@@ -18,7 +18,8 @@ import org.springframework.web.bind.annotation.RestController
|
|||||||
class ContentSeriesController(private val service: ContentSeriesService) {
|
class ContentSeriesController(private val service: ContentSeriesService) {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
fun getSeriesList(
|
fun getSeriesList(
|
||||||
@RequestParam creatorId: Long,
|
@RequestParam(required = false) creatorId: Long?,
|
||||||
|
@RequestParam(name = "isOriginal", required = false) isOriginal: 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?,
|
||||||
@@ -29,6 +30,7 @@ class ContentSeriesController(private val service: ContentSeriesService) {
|
|||||||
ApiResponse.ok(
|
ApiResponse.ok(
|
||||||
service.getSeriesList(
|
service.getSeriesList(
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
|
isOriginal = isOriginal ?: false,
|
||||||
isAdultContentVisible = isAdultContentVisible ?: true,
|
isAdultContentVisible = isAdultContentVisible ?: true,
|
||||||
contentType = contentType ?: ContentType.ALL,
|
contentType = contentType ?: ContentType.ALL,
|
||||||
member = member,
|
member = member,
|
||||||
|
|||||||
@@ -23,12 +23,13 @@ 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, contentType: ContentType, isOriginal: Boolean): Int
|
||||||
fun getSeriesList(
|
fun getSeriesList(
|
||||||
imageHost: String,
|
imageHost: String,
|
||||||
creatorId: Long,
|
creatorId: Long?,
|
||||||
isAuth: Boolean,
|
isAuth: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
|
isOriginal: Boolean,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long
|
limit: Long
|
||||||
): List<Series>
|
): List<Series>
|
||||||
@@ -59,9 +60,16 @@ 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, contentType: ContentType, isOriginal: Boolean): Int {
|
||||||
var where = series.member.id.eq(creatorId)
|
var where = series.isActive.isTrue
|
||||||
.and(series.isActive.isTrue)
|
|
||||||
|
if (creatorId != null) {
|
||||||
|
where = where.and(series.member.id.eq(creatorId))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isOriginal) {
|
||||||
|
where = where.and(series.isOriginal.isTrue)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAuth) {
|
if (!isAuth) {
|
||||||
where = where.and(series.isAdult.isFalse)
|
where = where.and(series.isAdult.isFalse)
|
||||||
@@ -92,14 +100,21 @@ class ContentSeriesQueryRepositoryImpl(
|
|||||||
|
|
||||||
override fun getSeriesList(
|
override fun getSeriesList(
|
||||||
imageHost: String,
|
imageHost: String,
|
||||||
creatorId: Long,
|
creatorId: Long?,
|
||||||
isAuth: Boolean,
|
isAuth: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
|
isOriginal: Boolean,
|
||||||
offset: Long,
|
offset: Long,
|
||||||
limit: Long
|
limit: Long
|
||||||
): List<Series> {
|
): List<Series> {
|
||||||
var where = series.member.id.eq(creatorId)
|
var where = series.isActive.isTrue
|
||||||
.and(series.isActive.isTrue)
|
|
||||||
|
if (creatorId != null) {
|
||||||
|
where = where.and(series.member.id.eq(creatorId))
|
||||||
|
}
|
||||||
|
if (isOriginal) {
|
||||||
|
where = where.and(series.isOriginal.isTrue)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAuth) {
|
if (!isAuth) {
|
||||||
where = where.and(series.isAdult.isFalse)
|
where = where.and(series.isAdult.isFalse)
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ class ContentSeriesService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getSeriesList(
|
fun getSeriesList(
|
||||||
creatorId: Long,
|
creatorId: Long?,
|
||||||
|
isOriginal: Boolean = false,
|
||||||
isAdultContentVisible: Boolean,
|
isAdultContentVisible: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
member: Member,
|
member: Member,
|
||||||
@@ -61,13 +62,16 @@ class ContentSeriesService(
|
|||||||
val totalCount = repository.getSeriesTotalCount(
|
val totalCount = repository.getSeriesTotalCount(
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
isAuth = isAuth,
|
isAuth = isAuth,
|
||||||
contentType = contentType
|
contentType = contentType,
|
||||||
|
isOriginal = isOriginal
|
||||||
)
|
)
|
||||||
|
|
||||||
val rawItems = repository.getSeriesList(
|
val rawItems = repository.getSeriesList(
|
||||||
imageHost = coverImageHost,
|
imageHost = coverImageHost,
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
isAuth = isAuth,
|
isAuth = isAuth,
|
||||||
contentType = contentType,
|
contentType = contentType,
|
||||||
|
isOriginal = isOriginal,
|
||||||
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