diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt index 242779e9..d30632e9 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt @@ -44,6 +44,7 @@ interface AudioContentQueryRepository { fun findByIdAndCreatorId(contentId: Long, creatorId: Long): AudioContent? fun findByCreatorId( creatorId: Long, + isCreator: Boolean = false, coverImageHost: String, isAdult: Boolean = false, contentType: ContentType = ContentType.ALL, @@ -55,6 +56,7 @@ interface AudioContentQueryRepository { fun findTotalCountByCreatorId( creatorId: Long, + isCreator: Boolean = false, isAdult: Boolean = false, categoryId: Long = 0, contentType: ContentType = ContentType.ALL @@ -230,6 +232,7 @@ class AudioContentQueryRepositoryImpl( override fun findByCreatorId( creatorId: Long, + isCreator: Boolean, coverImageHost: String, isAdult: Boolean, contentType: ContentType, @@ -246,11 +249,18 @@ class AudioContentQueryRepositoryImpl( } 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 .and(audioContent.duration.isNotNull) - .or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull)) ) + } if (!isAdult) { where = where.and(audioContent.isAdult.isFalse) @@ -332,16 +342,24 @@ class AudioContentQueryRepositoryImpl( override fun findTotalCountByCreatorId( creatorId: Long, + isCreator: Boolean, isAdult: Boolean, categoryId: Long, contentType: ContentType ): Int { 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 .and(audioContent.duration.isNotNull) - .or(audioContent.releaseDate.isNotNull.and(audioContent.duration.isNotNull)) ) + } if (!isAdult) { where = where.and(audioContent.isAdult.isFalse) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt index a61a2af6..fdd2fcd9 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt @@ -979,9 +979,11 @@ class AudioContentService( limit: Long ): GetAudioContentListResponse { val isAdult = member.auth != null && isAdultContentVisible + val isCreator = member.id == creatorId val totalCount = repository.findTotalCountByCreatorId( creatorId = creatorId, + isCreator = isCreator, isAdult = isAdult, categoryId = categoryId, contentType = contentType @@ -989,6 +991,7 @@ class AudioContentService( val audioContentList = repository.findByCreatorId( creatorId = creatorId, + isCreator = isCreator, coverImageHost = coverImageHost, isAdult = isAdult, contentType = contentType,