크리에이터 콘텐츠 - 본인(크리에이터)만 오픈예정 콘텐츠가 보이도록 설정 변경
This commit is contained in:
@@ -44,6 +44,7 @@ interface AudioContentQueryRepository {
|
|||||||
fun findByIdAndCreatorId(contentId: Long, creatorId: Long): AudioContent?
|
fun findByIdAndCreatorId(contentId: Long, creatorId: Long): AudioContent?
|
||||||
fun findByCreatorId(
|
fun findByCreatorId(
|
||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
|
isCreator: Boolean = false,
|
||||||
coverImageHost: String,
|
coverImageHost: String,
|
||||||
isAdult: Boolean = false,
|
isAdult: Boolean = false,
|
||||||
contentType: ContentType = ContentType.ALL,
|
contentType: ContentType = ContentType.ALL,
|
||||||
@@ -55,6 +56,7 @@ interface AudioContentQueryRepository {
|
|||||||
|
|
||||||
fun findTotalCountByCreatorId(
|
fun findTotalCountByCreatorId(
|
||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
|
isCreator: Boolean = false,
|
||||||
isAdult: Boolean = false,
|
isAdult: Boolean = false,
|
||||||
categoryId: Long = 0,
|
categoryId: Long = 0,
|
||||||
contentType: ContentType = ContentType.ALL
|
contentType: ContentType = ContentType.ALL
|
||||||
@@ -230,6 +232,7 @@ class AudioContentQueryRepositoryImpl(
|
|||||||
|
|
||||||
override fun findByCreatorId(
|
override fun findByCreatorId(
|
||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
|
isCreator: Boolean,
|
||||||
coverImageHost: String,
|
coverImageHost: String,
|
||||||
isAdult: Boolean,
|
isAdult: Boolean,
|
||||||
contentType: ContentType,
|
contentType: ContentType,
|
||||||
@@ -246,11 +249,18 @@ class AudioContentQueryRepositoryImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var where = audioContent.member.id.eq(creatorId)
|
var where = audioContent.member.id.eq(creatorId)
|
||||||
.and(
|
|
||||||
|
where = if (isCreator) {
|
||||||
|
where.and(
|
||||||
|
audioContent.releaseDate.isNotNull
|
||||||
|
.and(audioContent.duration.isNotNull)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
where.and(
|
||||||
audioContent.isActive.isTrue
|
audioContent.isActive.isTrue
|
||||||
.and(audioContent.duration.isNotNull)
|
.and(audioContent.duration.isNotNull)
|
||||||
.or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull))
|
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAdult) {
|
if (!isAdult) {
|
||||||
where = where.and(audioContent.isAdult.isFalse)
|
where = where.and(audioContent.isAdult.isFalse)
|
||||||
@@ -332,16 +342,24 @@ class AudioContentQueryRepositoryImpl(
|
|||||||
|
|
||||||
override fun findTotalCountByCreatorId(
|
override fun findTotalCountByCreatorId(
|
||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
|
isCreator: Boolean,
|
||||||
isAdult: Boolean,
|
isAdult: Boolean,
|
||||||
categoryId: Long,
|
categoryId: Long,
|
||||||
contentType: ContentType
|
contentType: ContentType
|
||||||
): Int {
|
): Int {
|
||||||
var where = audioContent.member.id.eq(creatorId)
|
var where = audioContent.member.id.eq(creatorId)
|
||||||
.and(
|
|
||||||
|
where = if (isCreator) {
|
||||||
|
where.and(
|
||||||
|
audioContent.releaseDate.isNotNull
|
||||||
|
.and(audioContent.duration.isNotNull)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
where.and(
|
||||||
audioContent.isActive.isTrue
|
audioContent.isActive.isTrue
|
||||||
.and(audioContent.duration.isNotNull)
|
.and(audioContent.duration.isNotNull)
|
||||||
.or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull))
|
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAdult) {
|
if (!isAdult) {
|
||||||
where = where.and(audioContent.isAdult.isFalse)
|
where = where.and(audioContent.isAdult.isFalse)
|
||||||
|
|||||||
@@ -979,9 +979,11 @@ class AudioContentService(
|
|||||||
limit: Long
|
limit: Long
|
||||||
): GetAudioContentListResponse {
|
): GetAudioContentListResponse {
|
||||||
val isAdult = member.auth != null && isAdultContentVisible
|
val isAdult = member.auth != null && isAdultContentVisible
|
||||||
|
val isCreator = member.id == creatorId
|
||||||
|
|
||||||
val totalCount = repository.findTotalCountByCreatorId(
|
val totalCount = repository.findTotalCountByCreatorId(
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
|
isCreator = isCreator,
|
||||||
isAdult = isAdult,
|
isAdult = isAdult,
|
||||||
categoryId = categoryId,
|
categoryId = categoryId,
|
||||||
contentType = contentType
|
contentType = contentType
|
||||||
@@ -989,6 +991,7 @@ class AudioContentService(
|
|||||||
|
|
||||||
val audioContentList = repository.findByCreatorId(
|
val audioContentList = repository.findByCreatorId(
|
||||||
creatorId = creatorId,
|
creatorId = creatorId,
|
||||||
|
isCreator = isCreator,
|
||||||
coverImageHost = coverImageHost,
|
coverImageHost = coverImageHost,
|
||||||
isAdult = isAdult,
|
isAdult = isAdult,
|
||||||
contentType = contentType,
|
contentType = contentType,
|
||||||
|
|||||||
Reference in New Issue
Block a user