Compare commits
No commits in common. "7577f48a09f66562921d3d8cf3d59f6b90e4e8cb" and "025190696484648afac67c7351117c34f7796c04" have entirely different histories.
7577f48a09
...
0251906964
|
@ -652,16 +652,6 @@ class AudioContentService(
|
||||||
audioContent.detail
|
audioContent.detail
|
||||||
}
|
}
|
||||||
|
|
||||||
val buyerList = if (
|
|
||||||
audioContent.member?.id == member.id &&
|
|
||||||
audioContent.limited != null &&
|
|
||||||
audioContent.remaining != null
|
|
||||||
) {
|
|
||||||
orderRepository.findBuyerListByContentId(id)
|
|
||||||
} else {
|
|
||||||
listOf()
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetAudioContentDetailResponse(
|
return GetAudioContentDetailResponse(
|
||||||
contentId = audioContent.id!!,
|
contentId = audioContent.id!!,
|
||||||
title = audioContent.title,
|
title = audioContent.title,
|
||||||
|
@ -706,8 +696,7 @@ class AudioContentService(
|
||||||
isNotify = creatorFollowing?.isNotify ?: false
|
isNotify = creatorFollowing?.isNotify ?: false
|
||||||
),
|
),
|
||||||
previousContent = previousContent,
|
previousContent = previousContent,
|
||||||
nextContent = nextContent,
|
nextContent = nextContent
|
||||||
buyerList = buyerList
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,7 @@ data class GetAudioContentDetailResponse(
|
||||||
val isAvailablePin: Boolean,
|
val isAvailablePin: Boolean,
|
||||||
val creator: AudioContentCreator,
|
val creator: AudioContentCreator,
|
||||||
val previousContent: OtherContentResponse?,
|
val previousContent: OtherContentResponse?,
|
||||||
val nextContent: OtherContentResponse?,
|
val nextContent: OtherContentResponse?
|
||||||
val buyerList: List<ContentBuyer>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data class OtherContentResponse @QueryProjection constructor(
|
data class OtherContentResponse @QueryProjection constructor(
|
||||||
|
@ -55,8 +54,3 @@ data class AudioContentCreator(
|
||||||
val isFollow: Boolean,
|
val isFollow: Boolean,
|
||||||
val isNotify: Boolean
|
val isNotify: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
data class ContentBuyer @QueryProjection constructor(
|
|
||||||
val nickname: String,
|
|
||||||
val profileImageUrl: String
|
|
||||||
)
|
|
||||||
|
|
|
@ -2,16 +2,13 @@ package kr.co.vividnext.sodalive.content.order
|
||||||
|
|
||||||
import com.querydsl.core.types.dsl.Expressions
|
import com.querydsl.core.types.dsl.Expressions
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||||
import kr.co.vividnext.sodalive.content.ContentBuyer
|
|
||||||
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
||||||
import kr.co.vividnext.sodalive.content.QContentBuyer
|
|
||||||
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem
|
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem
|
||||||
import kr.co.vividnext.sodalive.content.main.QGetAudioContentMainItem
|
import kr.co.vividnext.sodalive.content.main.QGetAudioContentMainItem
|
||||||
import kr.co.vividnext.sodalive.content.order.QOrder.order
|
import kr.co.vividnext.sodalive.content.order.QOrder.order
|
||||||
import kr.co.vividnext.sodalive.content.playlist.ContentIdAndEndDateData
|
import kr.co.vividnext.sodalive.content.playlist.ContentIdAndEndDateData
|
||||||
import kr.co.vividnext.sodalive.content.playlist.QContentIdAndEndDateData
|
import kr.co.vividnext.sodalive.content.playlist.QContentIdAndEndDateData
|
||||||
import kr.co.vividnext.sodalive.member.QMember.member
|
import kr.co.vividnext.sodalive.member.QMember.member
|
||||||
import org.springframework.beans.factory.annotation.Value
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
import org.springframework.stereotype.Repository
|
import org.springframework.stereotype.Repository
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
|
@ -43,16 +40,10 @@ interface OrderQueryRepository {
|
||||||
|
|
||||||
fun findOrderedContent(contentIdList: List<Long>, memberId: Long): List<Long>
|
fun findOrderedContent(contentIdList: List<Long>, memberId: Long): List<Long>
|
||||||
fun findEndDateByContentId(contentIdList: List<Long>, memberId: Long): List<ContentIdAndEndDateData>
|
fun findEndDateByContentId(contentIdList: List<Long>, memberId: Long): List<ContentIdAndEndDateData>
|
||||||
fun findBuyerListByContentId(contentId: Long): List<ContentBuyer>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
class OrderQueryRepositoryImpl(
|
class OrderQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : OrderQueryRepository {
|
||||||
private val queryFactory: JPAQueryFactory,
|
|
||||||
|
|
||||||
@Value("\${cloud.aws.cloud-front.host}")
|
|
||||||
private val imageHost: String
|
|
||||||
) : OrderQueryRepository {
|
|
||||||
override fun isExistOrdered(memberId: Long, contentId: Long): Boolean {
|
override fun isExistOrdered(memberId: Long, contentId: Long): Boolean {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.select(order.id)
|
.select(order.id)
|
||||||
|
@ -262,22 +253,4 @@ class OrderQueryRepositoryImpl(
|
||||||
)
|
)
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun findBuyerListByContentId(contentId: Long): List<ContentBuyer> {
|
|
||||||
return queryFactory
|
|
||||||
.select(
|
|
||||||
QContentBuyer(
|
|
||||||
member.nickname,
|
|
||||||
member.profileImage.prepend("/").prepend(imageHost)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.from(order)
|
|
||||||
.innerJoin(order.member, member)
|
|
||||||
.where(
|
|
||||||
order.isActive.isTrue,
|
|
||||||
order.audioContent.id.eq(contentId),
|
|
||||||
member.isActive.isTrue
|
|
||||||
)
|
|
||||||
.fetch()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue