Compare commits
No commits in common. "c60a7580ba4f7a09cdf7dbbbbafe4c9cd4528507" and "97edb56edc7fe7e429f841438af4005241a7deca" have entirely different histories.
c60a7580ba
...
97edb56edc
|
@ -185,7 +185,6 @@ class AdminCalculateQueryRepository(private val queryFactory: JPAQueryFactory) {
|
||||||
member.nickname,
|
member.nickname,
|
||||||
Expressions.stringTemplate("substring({0}, 1, 10)", creatorCommunity.content),
|
Expressions.stringTemplate("substring({0}, 1, 10)", creatorCommunity.content),
|
||||||
formattedDate,
|
formattedDate,
|
||||||
creatorCommunity.price,
|
|
||||||
useCan.id.count(),
|
useCan.id.count(),
|
||||||
useCan.can.add(useCan.rewardCan).sum()
|
useCan.can.add(useCan.rewardCan).sum()
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,6 @@ data class GetCalculateCommunityPostQueryData @QueryProjection constructor(
|
||||||
val nickname: String,
|
val nickname: String,
|
||||||
val title: String,
|
val title: String,
|
||||||
val date: String,
|
val date: String,
|
||||||
val can: Int,
|
|
||||||
val numberOfPurchase: Long,
|
val numberOfPurchase: Long,
|
||||||
val totalCan: Int
|
val totalCan: Int
|
||||||
) {
|
) {
|
||||||
|
@ -22,7 +21,6 @@ data class GetCalculateCommunityPostQueryData @QueryProjection constructor(
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
title = title,
|
title = title,
|
||||||
date = date,
|
date = date,
|
||||||
can = can,
|
|
||||||
numberOfPurchase = numberOfPurchase.toInt(),
|
numberOfPurchase = numberOfPurchase.toInt(),
|
||||||
totalCan = totalCan,
|
totalCan = totalCan,
|
||||||
totalKrw = totalKrw,
|
totalKrw = totalKrw,
|
||||||
|
|
|
@ -6,7 +6,6 @@ data class GetCalculateCommunityPostResponse(
|
||||||
@JsonProperty("nickname") val nickname: String,
|
@JsonProperty("nickname") val nickname: String,
|
||||||
@JsonProperty("title") val title: String,
|
@JsonProperty("title") val title: String,
|
||||||
@JsonProperty("date") val date: String,
|
@JsonProperty("date") val date: String,
|
||||||
@JsonProperty("can") val can: Int,
|
|
||||||
@JsonProperty("numberOfPurchase") val numberOfPurchase: Int,
|
@JsonProperty("numberOfPurchase") val numberOfPurchase: Int,
|
||||||
@JsonProperty("totalCan") val totalCan: Int,
|
@JsonProperty("totalCan") val totalCan: Int,
|
||||||
@JsonProperty("totalKrw") val totalKrw: Int,
|
@JsonProperty("totalKrw") val totalKrw: Int,
|
||||||
|
|
|
@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.admin.live.signature
|
||||||
|
|
||||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||||
import kr.co.vividnext.sodalive.common.SodaException
|
import kr.co.vividnext.sodalive.common.SodaException
|
||||||
import kr.co.vividnext.sodalive.live.signature.SignatureCanSortType
|
|
||||||
import org.springframework.data.domain.Pageable
|
import org.springframework.data.domain.Pageable
|
||||||
import org.springframework.security.access.prepost.PreAuthorize
|
import org.springframework.security.access.prepost.PreAuthorize
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
|
@ -18,10 +17,7 @@ import org.springframework.web.multipart.MultipartFile
|
||||||
@RequestMapping("/admin/live/signature-can")
|
@RequestMapping("/admin/live/signature-can")
|
||||||
class AdminSignatureCanController(private val service: AdminSignatureCanService) {
|
class AdminSignatureCanController(private val service: AdminSignatureCanService) {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
fun getSignatureCanList(
|
fun getSignatureCanList(pageable: Pageable) = ApiResponse.ok(data = service.getSignatureCanList(pageable))
|
||||||
pageable: Pageable,
|
|
||||||
@RequestParam("sort-type", required = false) sortType: SignatureCanSortType?
|
|
||||||
) = ApiResponse.ok(data = service.getSignatureCanList(pageable, sortType ?: SignatureCanSortType.NEWEST))
|
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
fun createSignatureCan(
|
fun createSignatureCan(
|
||||||
|
|
|
@ -3,7 +3,6 @@ package kr.co.vividnext.sodalive.admin.live.signature
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||||
import kr.co.vividnext.sodalive.live.signature.QSignatureCan.signatureCan
|
import kr.co.vividnext.sodalive.live.signature.QSignatureCan.signatureCan
|
||||||
import kr.co.vividnext.sodalive.live.signature.SignatureCan
|
import kr.co.vividnext.sodalive.live.signature.SignatureCan
|
||||||
import kr.co.vividnext.sodalive.live.signature.SignatureCanSortType
|
|
||||||
import kr.co.vividnext.sodalive.member.QMember.member
|
import kr.co.vividnext.sodalive.member.QMember.member
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
|
||||||
|
@ -12,12 +11,7 @@ interface AdminSignatureCanRepository : JpaRepository<SignatureCan, Long>, Admin
|
||||||
interface AdminSignatureCanQueryRepository {
|
interface AdminSignatureCanQueryRepository {
|
||||||
fun getSignatureCanListTotalCount(): Int
|
fun getSignatureCanListTotalCount(): Int
|
||||||
|
|
||||||
fun getSignatureCanList(
|
fun getSignatureCanList(imageHost: String, offset: Long, limit: Long): List<GetSignatureCanListItem>
|
||||||
sortType: SignatureCanSortType,
|
|
||||||
imageHost: String,
|
|
||||||
offset: Long,
|
|
||||||
limit: Long
|
|
||||||
): List<GetSignatureCanListItem>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class AdminSignatureCanQueryRepositoryImpl(
|
class AdminSignatureCanQueryRepositoryImpl(
|
||||||
|
@ -31,26 +25,7 @@ class AdminSignatureCanQueryRepositoryImpl(
|
||||||
.size
|
.size
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSignatureCanList(
|
override fun getSignatureCanList(imageHost: String, offset: Long, limit: Long): List<GetSignatureCanListItem> {
|
||||||
sortType: SignatureCanSortType,
|
|
||||||
imageHost: String,
|
|
||||||
offset: Long,
|
|
||||||
limit: Long
|
|
||||||
): List<GetSignatureCanListItem> {
|
|
||||||
val orderBy = when (sortType) {
|
|
||||||
SignatureCanSortType.CAN_HIGH -> {
|
|
||||||
signatureCan.can.desc()
|
|
||||||
}
|
|
||||||
|
|
||||||
SignatureCanSortType.CAN_LOW -> {
|
|
||||||
signatureCan.can.asc()
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
signatureCan.id.desc()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return queryFactory.select(
|
return queryFactory.select(
|
||||||
QGetSignatureCanListItem(
|
QGetSignatureCanListItem(
|
||||||
signatureCan.id,
|
signatureCan.id,
|
||||||
|
@ -66,7 +41,7 @@ class AdminSignatureCanQueryRepositoryImpl(
|
||||||
.where(signatureCan.isActive.isTrue)
|
.where(signatureCan.isActive.isTrue)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.orderBy(member.id.desc(), orderBy)
|
.orderBy(signatureCan.id.desc())
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.amazonaws.services.s3.model.ObjectMetadata
|
||||||
import kr.co.vividnext.sodalive.aws.s3.S3Uploader
|
import kr.co.vividnext.sodalive.aws.s3.S3Uploader
|
||||||
import kr.co.vividnext.sodalive.common.SodaException
|
import kr.co.vividnext.sodalive.common.SodaException
|
||||||
import kr.co.vividnext.sodalive.live.signature.SignatureCan
|
import kr.co.vividnext.sodalive.live.signature.SignatureCan
|
||||||
import kr.co.vividnext.sodalive.live.signature.SignatureCanSortType
|
|
||||||
import kr.co.vividnext.sodalive.member.MemberRepository
|
import kr.co.vividnext.sodalive.member.MemberRepository
|
||||||
import kr.co.vividnext.sodalive.utils.generateFileName
|
import kr.co.vividnext.sodalive.utils.generateFileName
|
||||||
import org.springframework.beans.factory.annotation.Value
|
import org.springframework.beans.factory.annotation.Value
|
||||||
|
@ -26,13 +25,9 @@ class AdminSignatureCanService(
|
||||||
@Value("\${cloud.aws.cloud-front.host}")
|
@Value("\${cloud.aws.cloud-front.host}")
|
||||||
private val imageHost: String
|
private val imageHost: String
|
||||||
) {
|
) {
|
||||||
fun getSignatureCanList(
|
fun getSignatureCanList(pageable: Pageable): GetSignatureCanListResponse {
|
||||||
pageable: Pageable,
|
|
||||||
sortType: SignatureCanSortType
|
|
||||||
): GetSignatureCanListResponse {
|
|
||||||
val totalCount = repository.getSignatureCanListTotalCount()
|
val totalCount = repository.getSignatureCanListTotalCount()
|
||||||
val items = repository.getSignatureCanList(
|
val items = repository.getSignatureCanList(
|
||||||
sortType = sortType,
|
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
offset = pageable.offset,
|
offset = pageable.offset,
|
||||||
limit = pageable.pageSize.toLong()
|
limit = pageable.pageSize.toLong()
|
||||||
|
|
|
@ -187,10 +187,7 @@ 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.loe(0)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.from(audioContent)
|
.from(audioContent)
|
||||||
|
|
|
@ -666,24 +666,12 @@ 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,8 +18,5 @@ 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
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -65,10 +65,8 @@ class ContentSeriesQueryRepositoryImpl(
|
||||||
|
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(series)
|
.selectFrom(series)
|
||||||
.innerJoin(series.contentList, seriesContent)
|
|
||||||
.innerJoin(seriesContent.content, audioContent)
|
|
||||||
.where(where)
|
.where(where)
|
||||||
.orderBy(audioContent.releaseDate.desc(), series.orders.asc(), series.createdAt.asc())
|
.orderBy(series.orders.asc(), series.createdAt.asc())
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.fetch()
|
.fetch()
|
||||||
|
|
|
@ -273,7 +273,6 @@ class CreatorAdminCalculateQueryRepository(private val queryFactory: JPAQueryFac
|
||||||
member.nickname,
|
member.nickname,
|
||||||
Expressions.stringTemplate("substring({0}, 1, 10)", creatorCommunity.content),
|
Expressions.stringTemplate("substring({0}, 1, 10)", creatorCommunity.content),
|
||||||
formattedDate,
|
formattedDate,
|
||||||
creatorCommunity.price,
|
|
||||||
useCan.id.count(),
|
useCan.id.count(),
|
||||||
useCan.can.add(useCan.rewardCan).sum()
|
useCan.can.add(useCan.rewardCan).sum()
|
||||||
)
|
)
|
||||||
|
|
|
@ -185,8 +185,19 @@ class CreatorCommunityService(
|
||||||
|
|
||||||
val existOrdered = useCanRepository.isExistOrdered(postId = it.id, memberId = memberId)
|
val existOrdered = useCanRepository.isExistOrdered(postId = it.id, memberId = memberId)
|
||||||
|
|
||||||
|
val content = if (it.price > 0 && memberId != it.creatorId) {
|
||||||
|
if (existOrdered) {
|
||||||
|
it.content
|
||||||
|
} else {
|
||||||
|
it.content.substring(0, 5).plus("...")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it.content
|
||||||
|
}
|
||||||
|
|
||||||
it.toCommunityPostListResponse(
|
it.toCommunityPostListResponse(
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
|
content = content,
|
||||||
date = getTimeAgoString(it.date),
|
date = getTimeAgoString(it.date),
|
||||||
isLike = isLike,
|
isLike = isLike,
|
||||||
existOrdered = if (memberId == it.creatorId) {
|
existOrdered = if (memberId == it.creatorId) {
|
||||||
|
@ -240,8 +251,19 @@ class CreatorCommunityService(
|
||||||
|
|
||||||
val existOrdered = useCanRepository.isExistOrdered(postId = post.id, memberId = memberId)
|
val existOrdered = useCanRepository.isExistOrdered(postId = post.id, memberId = memberId)
|
||||||
|
|
||||||
|
val content = if (post.price > 0 && memberId != post.creatorId) {
|
||||||
|
if (existOrdered) {
|
||||||
|
post.content
|
||||||
|
} else {
|
||||||
|
post.content.substring(0, 5).plus("...")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
post.content
|
||||||
|
}
|
||||||
|
|
||||||
return post.toCommunityPostListResponse(
|
return post.toCommunityPostListResponse(
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
|
content = content,
|
||||||
date = getTimeAgoString(post.date),
|
date = getTimeAgoString(post.date),
|
||||||
isLike = isLike,
|
isLike = isLike,
|
||||||
existOrdered = if (memberId == post.creatorId) {
|
existOrdered = if (memberId == post.creatorId) {
|
||||||
|
@ -382,10 +404,10 @@ class CreatorCommunityService(
|
||||||
}
|
}
|
||||||
.map {
|
.map {
|
||||||
val isLike =
|
val isLike =
|
||||||
likeRepository.findByPostIdAndMemberId(postId = it.id, memberId = memberId)?.isActive ?: false
|
likeRepository.findByPostIdAndMemberId(postId = it.id!!, memberId = memberId)?.isActive ?: false
|
||||||
val likeCount = likeRepository.totalCountCommunityPostLikeByPostId(it.id)
|
val likeCount = likeRepository.totalCountCommunityPostLikeByPostId(it.id!!)
|
||||||
val commentCount = if (it.isCommentAvailable) {
|
val commentCount = if (it.isCommentAvailable) {
|
||||||
commentRepository.totalCountCommentByPostId(postId = it.id)
|
commentRepository.totalCountCommentByPostId(postId = it.id!!)
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
@ -409,8 +431,19 @@ class CreatorCommunityService(
|
||||||
|
|
||||||
val existOrdered = useCanRepository.isExistOrdered(postId = it.id, memberId = memberId)
|
val existOrdered = useCanRepository.isExistOrdered(postId = it.id, memberId = memberId)
|
||||||
|
|
||||||
|
val content = if (it.price > 0 && memberId != it.creatorId) {
|
||||||
|
if (existOrdered) {
|
||||||
|
it.content
|
||||||
|
} else {
|
||||||
|
it.content.substring(0, 5).plus("...")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
it.content
|
||||||
|
}
|
||||||
|
|
||||||
it.toCommunityPostListResponse(
|
it.toCommunityPostListResponse(
|
||||||
imageHost = imageHost,
|
imageHost = imageHost,
|
||||||
|
content = content,
|
||||||
date = getTimeAgoString(it.date),
|
date = getTimeAgoString(it.date),
|
||||||
isLike = isLike,
|
isLike = isLike,
|
||||||
existOrdered = if (memberId == it.creatorId) {
|
existOrdered = if (memberId == it.creatorId) {
|
||||||
|
|
|
@ -17,6 +17,7 @@ data class SelectCommunityPostResponse @QueryProjection constructor(
|
||||||
) {
|
) {
|
||||||
fun toCommunityPostListResponse(
|
fun toCommunityPostListResponse(
|
||||||
imageHost: String,
|
imageHost: String,
|
||||||
|
content: String,
|
||||||
date: String,
|
date: String,
|
||||||
isLike: Boolean,
|
isLike: Boolean,
|
||||||
existOrdered: Boolean,
|
existOrdered: Boolean,
|
||||||
|
|
Loading…
Reference in New Issue