Compare commits
2 Commits
0251906964
...
7577f48a09
Author | SHA1 | Date |
---|---|---|
|
7577f48a09 | |
|
5759a51017 |
|
@ -652,6 +652,16 @@ 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,
|
||||||
|
@ -696,7 +706,8 @@ class AudioContentService(
|
||||||
isNotify = creatorFollowing?.isNotify ?: false
|
isNotify = creatorFollowing?.isNotify ?: false
|
||||||
),
|
),
|
||||||
previousContent = previousContent,
|
previousContent = previousContent,
|
||||||
nextContent = nextContent
|
nextContent = nextContent,
|
||||||
|
buyerList = buyerList
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@ 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(
|
||||||
|
@ -54,3 +55,8 @@ 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,13 +2,16 @@ 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
|
||||||
|
@ -40,10 +43,16 @@ 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(private val queryFactory: JPAQueryFactory) : OrderQueryRepository {
|
class OrderQueryRepositoryImpl(
|
||||||
|
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)
|
||||||
|
@ -253,4 +262,22 @@ class OrderQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : Orde
|
||||||
)
|
)
|
||||||
.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