parent
ae439b7e64
commit
198ecddc89
|
@ -22,6 +22,7 @@ import kr.co.vividnext.sodalive.content.pin.QPinContent.pinContent
|
|||
import kr.co.vividnext.sodalive.content.playlist.AudioContentPlaylistContent
|
||||
import kr.co.vividnext.sodalive.content.playlist.QAudioContentPlaylistContent
|
||||
import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.QSeriesContent.seriesContent
|
||||
import kr.co.vividnext.sodalive.event.QEvent.event
|
||||
import kr.co.vividnext.sodalive.member.MemberRole
|
||||
import kr.co.vividnext.sodalive.member.QMember.member
|
||||
|
@ -163,6 +164,8 @@ interface AudioContentQueryRepository {
|
|||
|
||||
fun fetchContentForPlaylist(contentIdList: List<Long>): List<AudioContentPlaylistContent>
|
||||
fun getCoverImageById(id: Long): String?
|
||||
fun findPreviousContent(title: String): OtherContentResponse?
|
||||
fun findNextContent(title: String): OtherContentResponse?
|
||||
}
|
||||
|
||||
@Repository
|
||||
|
@ -1152,4 +1155,38 @@ class AudioContentQueryRepositoryImpl(
|
|||
.where(audioContent.id.eq(id))
|
||||
.fetchFirst()
|
||||
}
|
||||
|
||||
override fun findPreviousContent(title: String): OtherContentResponse? {
|
||||
return queryFactory
|
||||
.select(
|
||||
QOtherContentResponse(
|
||||
audioContent.id,
|
||||
audioContent.title,
|
||||
audioContent.coverImage.prepend("$imageHost/")
|
||||
)
|
||||
)
|
||||
.from(seriesContent)
|
||||
.innerJoin(seriesContent.content, audioContent)
|
||||
.where(audioContent.title.lt(title))
|
||||
.orderBy(audioContent.title.asc())
|
||||
.limit(1)
|
||||
.fetchFirst()
|
||||
}
|
||||
|
||||
override fun findNextContent(title: String): OtherContentResponse? {
|
||||
return queryFactory
|
||||
.select(
|
||||
QOtherContentResponse(
|
||||
audioContent.id,
|
||||
audioContent.title,
|
||||
audioContent.coverImage.prepend("$imageHost/")
|
||||
)
|
||||
)
|
||||
.from(seriesContent)
|
||||
.innerJoin(seriesContent.content, audioContent)
|
||||
.where(audioContent.title.gt(title))
|
||||
.orderBy(audioContent.title.asc())
|
||||
.limit(1)
|
||||
.fetchFirst()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -473,6 +473,9 @@ class AudioContentService(
|
|||
null
|
||||
}
|
||||
|
||||
val previousContent = repository.findPreviousContent(title = audioContent.title)
|
||||
val nextContent = repository.findNextContent(title = audioContent.title)
|
||||
|
||||
if (
|
||||
!isExistsAudioContent &&
|
||||
!audioContent.isActive &&
|
||||
|
@ -666,7 +669,9 @@ class AudioContentService(
|
|||
isFollowing = creatorFollowing?.isFollow ?: false,
|
||||
isFollow = creatorFollowing?.isFollow ?: false,
|
||||
isNotify = creatorFollowing?.isNotify ?: false
|
||||
)
|
||||
),
|
||||
previousContent = previousContent,
|
||||
nextContent = nextContent
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,9 @@ data class GetAudioContentDetailResponse(
|
|||
val commentCount: Int,
|
||||
val isPin: Boolean,
|
||||
val isAvailablePin: Boolean,
|
||||
val creator: AudioContentCreator
|
||||
val creator: AudioContentCreator,
|
||||
val previousContent: OtherContentResponse?,
|
||||
val nextContent: OtherContentResponse?
|
||||
)
|
||||
|
||||
data class OtherContentResponse @QueryProjection constructor(
|
||||
|
|
Loading…
Reference in New Issue