parent
4cee0e3585
commit
a529f05825
|
@ -187,7 +187,10 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
Expressions.constant(0),
|
Expressions.constant(0),
|
||||||
pinContent.id.isNotNull,
|
pinContent.id.isNotNull,
|
||||||
audioContent.isAdult,
|
audioContent.isAdult,
|
||||||
audioContent.releaseDate.gt(LocalDateTime.now())
|
audioContent.releaseDate.gt(LocalDateTime.now()),
|
||||||
|
Expressions.asBoolean(false),
|
||||||
|
Expressions.asBoolean(false),
|
||||||
|
audioContent.remaining.isNotNull.and(audioContent.remaining.loe(0))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.from(audioContent)
|
.from(audioContent)
|
||||||
|
|
|
@ -666,12 +666,24 @@ class AudioContentService(
|
||||||
.map {
|
.map {
|
||||||
val commentCount = commentRepository
|
val commentCount = commentRepository
|
||||||
.totalCountCommentByContentId(it.contentId)
|
.totalCountCommentByContentId(it.contentId)
|
||||||
|
it.commentCount = commentCount
|
||||||
|
|
||||||
val likeCount = audioContentLikeRepository
|
val likeCount = audioContentLikeRepository
|
||||||
.totalCountAudioContentLike(it.contentId)
|
.totalCountAudioContentLike(it.contentId)
|
||||||
|
|
||||||
it.likeCount = likeCount
|
it.likeCount = likeCount
|
||||||
it.commentCount = commentCount
|
|
||||||
|
val (isExistsAudioContent, orderType) = orderRepository.isExistOrderedAndOrderType(
|
||||||
|
memberId = member.id!!,
|
||||||
|
contentId = it.contentId
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isExistsAudioContent) {
|
||||||
|
if (orderType == OrderType.RENTAL) {
|
||||||
|
it.isRented = true
|
||||||
|
} else {
|
||||||
|
it.isOwned = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
it
|
it
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,8 @@ data class GetAudioContentListItem @QueryProjection constructor(
|
||||||
var commentCount: Int = 0,
|
var commentCount: Int = 0,
|
||||||
val isPin: Boolean,
|
val isPin: Boolean,
|
||||||
val isAdult: Boolean,
|
val isAdult: Boolean,
|
||||||
val isScheduledToOpen: Boolean
|
val isScheduledToOpen: Boolean,
|
||||||
|
var isRented: Boolean,
|
||||||
|
var isOwned: Boolean,
|
||||||
|
var isSoldOut: Boolean
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue