feat(creatorname): 레거시 조회와 검색에 언어별 이름을 적용한다
This commit is contained in:
@@ -3,9 +3,11 @@ package kr.co.vividnext.sodalive.content
|
||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.content.like.PutAudioContentLikeRequest
|
||||
import kr.co.vividnext.sodalive.i18n.LangContext
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
||||
import kr.co.vividnext.sodalive.member.contentpreference.ViewerContentPreference
|
||||
import kr.co.vividnext.sodalive.v2.creatorname.application.CreatorLocalizedNameService
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.lang.Nullable
|
||||
import org.springframework.security.access.prepost.PreAuthorize
|
||||
@@ -29,7 +31,9 @@ import java.time.temporal.TemporalAdjusters
|
||||
@RequestMapping("/audio-content")
|
||||
class AudioContentController(
|
||||
private val service: AudioContentService,
|
||||
private val memberContentPreferenceService: MemberContentPreferenceService
|
||||
private val memberContentPreferenceService: MemberContentPreferenceService,
|
||||
private val localizedNameService: CreatorLocalizedNameService,
|
||||
private val langContext: LangContext
|
||||
) {
|
||||
@PostMapping
|
||||
@PreAuthorize("hasRole('CREATOR')")
|
||||
@@ -214,7 +218,10 @@ class AudioContentController(
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize.toLong(),
|
||||
sortType = sortType ?: "매출"
|
||||
)
|
||||
).let { response ->
|
||||
val names = localizedNameService.findCurrentNames(response.items.map { it.creatorId }, langContext.lang)
|
||||
response.copy(items = response.items.map { it.copy(creatorNickname = names[it.creatorId] ?: it.creatorNickname) })
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,11 @@ import kr.co.vividnext.sodalive.content.translation.QContentTranslation.contentT
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.QSeries.series
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.QSeriesContent.seriesContent
|
||||
import kr.co.vividnext.sodalive.event.QEvent.event
|
||||
import kr.co.vividnext.sodalive.i18n.Lang
|
||||
import kr.co.vividnext.sodalive.member.MemberRole
|
||||
import kr.co.vividnext.sodalive.member.QMember.member
|
||||
import kr.co.vividnext.sodalive.member.block.QBlockMember.blockMember
|
||||
import kr.co.vividnext.sodalive.v2.creatorname.adapter.out.persistence.CreatorNameJoin
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.stereotype.Repository
|
||||
@@ -85,7 +87,8 @@ interface AudioContentQueryRepository {
|
||||
contentType: ContentType,
|
||||
offset: Long = 0,
|
||||
limit: Long = 20,
|
||||
isFree: Boolean = false
|
||||
isFree: Boolean = false,
|
||||
lang: Lang = Lang.KO
|
||||
): List<GetAudioContentMainItem>
|
||||
|
||||
fun findAlarmContentByTheme(
|
||||
@@ -167,7 +170,7 @@ interface AudioContentQueryRepository {
|
||||
|
||||
fun isContentCreator(contentId: Long, memberId: Long): Boolean
|
||||
|
||||
fun fetchContentForPlaylist(contentIdList: List<Long>): List<AudioContentPlaylistContent>
|
||||
fun fetchContentForPlaylist(contentIdList: List<Long>, lang: Lang = Lang.KO): List<AudioContentPlaylistContent>
|
||||
fun getCoverImageById(id: Long): String?
|
||||
fun findPreviousContent(seriesId: Long, title: String, isAdult: Boolean): OtherContentResponse?
|
||||
fun findNextContent(seriesId: Long, title: String, isAdult: Boolean): OtherContentResponse?
|
||||
@@ -467,8 +470,10 @@ class AudioContentQueryRepositoryImpl(
|
||||
contentType: ContentType,
|
||||
offset: Long,
|
||||
limit: Long,
|
||||
isFree: Boolean
|
||||
isFree: Boolean,
|
||||
lang: Lang
|
||||
): List<GetAudioContentMainItem> {
|
||||
val creatorName = CreatorNameJoin(member, lang, "themeCreatorName")
|
||||
val blockMemberCondition = blockMember.isActive.isTrue
|
||||
.and(
|
||||
blockMember.member.id.eq(member.id)
|
||||
@@ -535,7 +540,7 @@ class AudioContentQueryRepositoryImpl(
|
||||
where = where.and(audioContent.price.loe(0))
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
val query = queryFactory
|
||||
.select(
|
||||
QGetAudioContentMainItem(
|
||||
audioContent.id,
|
||||
@@ -543,7 +548,7 @@ class AudioContentQueryRepositoryImpl(
|
||||
audioContent.title,
|
||||
member.id,
|
||||
member.profileImage.prepend("/").prepend(imageHost),
|
||||
member.nickname,
|
||||
creatorName.displayName,
|
||||
audioContent.price,
|
||||
audioContent.duration,
|
||||
audioContent.isPointAvailable
|
||||
@@ -557,7 +562,8 @@ class AudioContentQueryRepositoryImpl(
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
.orderBy(*orderBy.toTypedArray())
|
||||
.fetch()
|
||||
query.leftJoin(creatorName.name).on(creatorName.condition)
|
||||
return query.fetch()
|
||||
}
|
||||
|
||||
override fun findAlarmContentByTheme(
|
||||
@@ -1210,7 +1216,8 @@ class AudioContentQueryRepositoryImpl(
|
||||
return foundedContentId != null && foundedContentId == contentId
|
||||
}
|
||||
|
||||
override fun fetchContentForPlaylist(contentIdList: List<Long>): List<AudioContentPlaylistContent> {
|
||||
override fun fetchContentForPlaylist(contentIdList: List<Long>, lang: Lang): List<AudioContentPlaylistContent> {
|
||||
val creatorName = CreatorNameJoin(member, lang, "playlistCreatorName")
|
||||
return queryFactory
|
||||
.select(
|
||||
QAudioContentPlaylistContent(
|
||||
@@ -1219,12 +1226,13 @@ class AudioContentQueryRepositoryImpl(
|
||||
audioContentTheme.theme,
|
||||
audioContent.coverImage.prepend("/").prepend(imageHost),
|
||||
audioContent.duration,
|
||||
member.nickname,
|
||||
creatorName.displayName,
|
||||
member.profileImage.prepend("/").prepend(imageHost)
|
||||
)
|
||||
)
|
||||
.from(audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.leftJoin(creatorName.name).on(creatorName.condition)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
.where(audioContent.id.`in`(contentIdList))
|
||||
.fetch()
|
||||
@@ -1466,6 +1474,7 @@ class AudioContentQueryRepositoryImpl(
|
||||
}
|
||||
|
||||
val coverImageUrl = audioContent.coverImage.prepend("/").prepend(imageHost)
|
||||
val creatorName = CreatorNameJoin(member, Lang.fromCode(locale), "latestCreatorName")
|
||||
|
||||
var select = queryFactory
|
||||
.select(
|
||||
@@ -1474,11 +1483,12 @@ class AudioContentQueryRepositoryImpl(
|
||||
audioContent.title,
|
||||
contentTranslation.renderedPayload,
|
||||
coverImageUrl,
|
||||
member.nickname,
|
||||
creatorName.displayName,
|
||||
audioContent.isPointAvailable
|
||||
)
|
||||
.from(audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.leftJoin(creatorName.name).on(creatorName.condition)
|
||||
.innerJoin(audioContent.theme, audioContentTheme)
|
||||
.leftJoin(contentTranslation)
|
||||
.on(contentTranslation.contentId.eq(audioContent.id).and(contentTranslation.locale.eq(locale)))
|
||||
@@ -1523,7 +1533,7 @@ class AudioContentQueryRepositoryImpl(
|
||||
val payload = row.get(contentTranslation.renderedPayload)
|
||||
val translatedTitle = payload?.title
|
||||
val imageUrl = row.get(coverImageUrl)!!
|
||||
val creatorNickname = row.get(member.nickname)!!
|
||||
val creatorNickname = row.get(creatorName.displayName)!!
|
||||
val isPointAvailableValue = row.get(audioContent.isPointAvailable) ?: false
|
||||
|
||||
AudioContentMainItem(
|
||||
|
||||
@@ -40,6 +40,7 @@ import kr.co.vividnext.sodalive.member.MemberRepository
|
||||
import kr.co.vividnext.sodalive.member.block.BlockMemberRepository
|
||||
import kr.co.vividnext.sodalive.member.contentpreference.MemberContentPreferenceService
|
||||
import kr.co.vividnext.sodalive.utils.generateFileName
|
||||
import kr.co.vividnext.sodalive.v2.creatorname.application.CreatorLocalizedNameService
|
||||
import kr.co.vividnext.sodalive.v2.home.following.application.HomeFollowingNewsPublishService
|
||||
import kr.co.vividnext.sodalive.v2.recommendation.application.CreatorContentViewHistoryService
|
||||
import org.slf4j.LoggerFactory
|
||||
@@ -87,6 +88,7 @@ class AudioContentService(
|
||||
|
||||
private val messageSource: SodaMessageSource,
|
||||
private val langContext: LangContext,
|
||||
private val localizedNameService: CreatorLocalizedNameService,
|
||||
|
||||
private val contentThemeTranslationRepository: ContentThemeTranslationRepository,
|
||||
private val homeFollowingNewsPublishService: HomeFollowingNewsPublishService,
|
||||
@@ -512,6 +514,7 @@ class AudioContentService(
|
||||
type = FcmEventType.UPLOAD_CONTENT,
|
||||
category = PushNotificationCategory.CONTENT,
|
||||
title = audioContent.member!!.nickname,
|
||||
titleMemberId = audioContent.member!!.id,
|
||||
messageKey = "content.notification.uploaded_message",
|
||||
senderMemberId = audioContent.member!!.id,
|
||||
args = listOf(audioContent.title),
|
||||
@@ -542,6 +545,7 @@ class AudioContentService(
|
||||
type = FcmEventType.UPLOAD_CONTENT,
|
||||
category = PushNotificationCategory.CONTENT,
|
||||
title = audioContent.member!!.nickname,
|
||||
titleMemberId = audioContent.member!!.id,
|
||||
messageKey = "content.notification.uploaded_message",
|
||||
senderMemberId = audioContent.member!!.id,
|
||||
args = listOf(audioContent.title),
|
||||
@@ -702,7 +706,8 @@ class AudioContentService(
|
||||
isContentCreator = creatorId == member.id!!,
|
||||
timezone = timezone,
|
||||
offset = 0,
|
||||
limit = 1
|
||||
limit = 1,
|
||||
lang = langContext.lang
|
||||
)
|
||||
} else {
|
||||
listOf()
|
||||
@@ -844,7 +849,7 @@ class AudioContentService(
|
||||
audioContent.limited != null &&
|
||||
audioContent.remaining != null
|
||||
) {
|
||||
orderRepository.findBuyerListByContentId(id)
|
||||
orderRepository.findBuyerListByContentId(id, langContext.lang)
|
||||
} else {
|
||||
listOf()
|
||||
}
|
||||
@@ -920,6 +925,10 @@ class AudioContentService(
|
||||
)
|
||||
}
|
||||
|
||||
val names = localizedNameService.findLocalizedNames(
|
||||
listOf(creatorId),
|
||||
langContext.lang
|
||||
)
|
||||
return GetAudioContentDetailResponse(
|
||||
contentId = audioContent.id!!,
|
||||
title = audioContent.title,
|
||||
@@ -955,7 +964,7 @@ class AudioContentService(
|
||||
isAvailablePin = isAvailablePin,
|
||||
creator = AudioContentCreator(
|
||||
creatorId = creatorId,
|
||||
nickname = creator.nickname,
|
||||
nickname = names[creatorId] ?: creator.nickname,
|
||||
profileImageUrl = if (creator.profileImage != null) {
|
||||
"$coverImageHost/${creator.profileImage}"
|
||||
} else {
|
||||
|
||||
+7
-3
@@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.content.comment
|
||||
|
||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.i18n.LangContext
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.useraction.ActionType
|
||||
import kr.co.vividnext.sodalive.useraction.UserActionService
|
||||
@@ -18,7 +19,8 @@ import org.springframework.web.bind.annotation.RestController
|
||||
@RestController
|
||||
class AudioContentCommentController(
|
||||
private val service: AudioContentCommentService,
|
||||
private val userActionService: UserActionService
|
||||
private val userActionService: UserActionService,
|
||||
private val langContext: LangContext
|
||||
) {
|
||||
@PostMapping("/audio-content/comment")
|
||||
fun registerComment(
|
||||
@@ -79,7 +81,8 @@ class AudioContentCommentController(
|
||||
audioContentId = audioContentId,
|
||||
memberId = member.id!!,
|
||||
timezone = timezone,
|
||||
pageable = pageable
|
||||
pageable = pageable,
|
||||
lang = langContext.lang
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -98,7 +101,8 @@ class AudioContentCommentController(
|
||||
commentId = commentId,
|
||||
memberId = member.id!!,
|
||||
timezone = timezone,
|
||||
pageable = pageable
|
||||
pageable = pageable,
|
||||
lang = langContext.lang
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
+27
-15
@@ -1,16 +1,18 @@
|
||||
package kr.co.vividnext.sodalive.content.comment
|
||||
|
||||
import com.querydsl.core.types.dsl.CaseBuilder
|
||||
import com.querydsl.core.types.dsl.Expressions
|
||||
import com.querydsl.jpa.JPAExpressions
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
||||
import kr.co.vividnext.sodalive.content.comment.QAudioContentComment.audioContentComment
|
||||
import kr.co.vividnext.sodalive.extensions.removeDeletedNicknamePrefix
|
||||
import kr.co.vividnext.sodalive.fcm.PushTokenInfo
|
||||
import kr.co.vividnext.sodalive.fcm.QPushToken.pushToken
|
||||
import kr.co.vividnext.sodalive.fcm.QPushTokenInfo
|
||||
import kr.co.vividnext.sodalive.i18n.Lang
|
||||
import kr.co.vividnext.sodalive.member.QMember.member
|
||||
import kr.co.vividnext.sodalive.member.block.QBlockMember.blockMember
|
||||
import kr.co.vividnext.sodalive.v2.creatorname.adapter.out.persistence.CreatorNameJoin
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.stereotype.Repository
|
||||
import java.time.LocalDateTime
|
||||
@@ -26,7 +28,8 @@ interface AudioContentCommentQueryRepository {
|
||||
isContentCreator: Boolean,
|
||||
timezone: String,
|
||||
offset: Long,
|
||||
limit: Int
|
||||
limit: Int,
|
||||
lang: Lang? = null
|
||||
): List<GetAudioContentCommentListItem>
|
||||
|
||||
fun totalCountCommentByContentId(contentId: Long, memberId: Long, isContentCreator: Boolean): Int
|
||||
@@ -37,7 +40,8 @@ interface AudioContentCommentQueryRepository {
|
||||
memberId: Long,
|
||||
timezone: String,
|
||||
offset: Long,
|
||||
limit: Int
|
||||
limit: Int,
|
||||
lang: Lang? = null
|
||||
): List<GetAudioContentCommentListItem>
|
||||
|
||||
fun findPushTokenByContentIdAndCommentParentIdMyMemberId(
|
||||
@@ -58,8 +62,13 @@ class AudioContentCommentQueryRepositoryImpl(
|
||||
isContentCreator: Boolean,
|
||||
timezone: String,
|
||||
offset: Long,
|
||||
limit: Int
|
||||
limit: Int,
|
||||
lang: Lang?
|
||||
): List<GetAudioContentCommentListItem> {
|
||||
val creatorName = lang?.let { CreatorNameJoin(member, it, "audioCommentWriterName") }
|
||||
val originalName = CaseBuilder().`when`(member.nickname.startsWith("deleted_"))
|
||||
.then(member.nickname.substring(8)).otherwise(member.nickname)
|
||||
val displayName = creatorName?.name?.displayName?.coalesce(originalName) ?: originalName
|
||||
var where = audioContentComment.audioContent.id.eq(contentId)
|
||||
.and(audioContentComment.isActive.isTrue)
|
||||
.and(audioContentComment.parent.isNull)
|
||||
@@ -85,12 +94,12 @@ class AudioContentCommentQueryRepositoryImpl(
|
||||
"%Y.%m.%d %W %h:%i %p"
|
||||
)
|
||||
|
||||
return queryFactory
|
||||
val query = queryFactory
|
||||
.select(
|
||||
QGetAudioContentCommentListItem(
|
||||
audioContentComment.id,
|
||||
audioContentComment.member.id,
|
||||
audioContentComment.member.nickname,
|
||||
displayName,
|
||||
audioContentComment.member.profileImage.prepend("/").prepend(cloudFrontHost),
|
||||
audioContentComment.comment,
|
||||
audioContentComment.languageCode,
|
||||
@@ -107,10 +116,10 @@ class AudioContentCommentQueryRepositoryImpl(
|
||||
.offset(offset)
|
||||
.limit(limit.toLong())
|
||||
.orderBy(audioContentComment.createdAt.desc())
|
||||
.fetch()
|
||||
if (creatorName != null) query.leftJoin(creatorName.name).on(creatorName.condition)
|
||||
return query.fetch()
|
||||
.map {
|
||||
it.copy(
|
||||
nickname = it.nickname.removeDeletedNicknamePrefix(),
|
||||
replyCount = commentReplyCountByAudioContentCommentId(it.id, memberId)
|
||||
)
|
||||
}
|
||||
@@ -160,8 +169,13 @@ class AudioContentCommentQueryRepositoryImpl(
|
||||
memberId: Long,
|
||||
timezone: String,
|
||||
offset: Long,
|
||||
limit: Int
|
||||
limit: Int,
|
||||
lang: Lang?
|
||||
): List<GetAudioContentCommentListItem> {
|
||||
val creatorName = lang?.let { CreatorNameJoin(member, it, "audioReplyWriterName") }
|
||||
val originalName = CaseBuilder().`when`(member.nickname.startsWith("deleted_"))
|
||||
.then(member.nickname.substring(8)).otherwise(member.nickname)
|
||||
val displayName = creatorName?.name?.displayName?.coalesce(originalName) ?: originalName
|
||||
val formattedDate = Expressions.stringTemplate(
|
||||
"DATE_FORMAT({0}, {1})",
|
||||
Expressions.dateTimeTemplate(
|
||||
@@ -174,12 +188,12 @@ class AudioContentCommentQueryRepositoryImpl(
|
||||
"%Y.%m.%d %W %h:%i %p"
|
||||
)
|
||||
|
||||
return queryFactory
|
||||
val query = queryFactory
|
||||
.select(
|
||||
QGetAudioContentCommentListItem(
|
||||
audioContentComment.id,
|
||||
audioContentComment.member.id,
|
||||
audioContentComment.member.nickname,
|
||||
displayName,
|
||||
audioContentComment.member.profileImage.prepend("/").prepend(cloudFrontHost),
|
||||
audioContentComment.comment,
|
||||
audioContentComment.languageCode,
|
||||
@@ -201,10 +215,8 @@ class AudioContentCommentQueryRepositoryImpl(
|
||||
.offset(offset)
|
||||
.limit(limit.toLong())
|
||||
.orderBy(audioContentComment.createdAt.desc())
|
||||
.fetch()
|
||||
.map {
|
||||
it.copy(nickname = it.nickname.removeDeletedNicknamePrefix())
|
||||
}
|
||||
if (creatorName != null) query.leftJoin(creatorName.name).on(creatorName.condition)
|
||||
return query.fetch()
|
||||
}
|
||||
|
||||
override fun findPushTokenByContentIdAndCommentParentIdMyMemberId(
|
||||
|
||||
+15
-5
@@ -9,10 +9,12 @@ import kr.co.vividnext.sodalive.fcm.FcmDeepLinkValue
|
||||
import kr.co.vividnext.sodalive.fcm.FcmEvent
|
||||
import kr.co.vividnext.sodalive.fcm.FcmEventType
|
||||
import kr.co.vividnext.sodalive.fcm.notification.PushNotificationCategory
|
||||
import kr.co.vividnext.sodalive.i18n.Lang
|
||||
import kr.co.vividnext.sodalive.i18n.LangContext
|
||||
import kr.co.vividnext.sodalive.i18n.SodaMessageSource
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.member.block.BlockMemberRepository
|
||||
import kr.co.vividnext.sodalive.v2.creatorname.application.CreatorLocalizedNameService
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.context.ApplicationEventPublisher
|
||||
import org.springframework.data.domain.Pageable
|
||||
@@ -30,6 +32,7 @@ class AudioContentCommentService(
|
||||
private val orderRepository: OrderRepository,
|
||||
private val messageSource: SodaMessageSource,
|
||||
private val langContext: LangContext,
|
||||
private val localizedNameService: CreatorLocalizedNameService,
|
||||
|
||||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val cloudFrontHost: String
|
||||
@@ -49,7 +52,9 @@ class AudioContentCommentService(
|
||||
val creator = audioContent.member!!
|
||||
val isBlocked = isBlockedBetweenMembers(memberId = member.id!!, creatorId = creator.id!!)
|
||||
if (isBlocked) {
|
||||
throw SodaException(formatMessage("content.comment.error.blocked_by_creator", creator.nickname))
|
||||
val name = localizedNameService.findLocalizedNames(listOf(creator.id!!), langContext.lang)[creator.id]
|
||||
?: creator.nickname
|
||||
throw SodaException(formatMessage("content.comment.error.blocked_by_creator", name))
|
||||
}
|
||||
|
||||
val (isExistsAudioContent, _) = orderRepository.isExistOrderedAndOrderType(
|
||||
@@ -86,6 +91,7 @@ class AudioContentCommentService(
|
||||
} else {
|
||||
member.nickname
|
||||
},
|
||||
titleMemberId = parent?.member?.id ?: member.id,
|
||||
messageKey = if (parent != null) {
|
||||
"content.comment.notification.reply"
|
||||
} else {
|
||||
@@ -140,7 +146,8 @@ class AudioContentCommentService(
|
||||
audioContentId: Long,
|
||||
memberId: Long,
|
||||
timezone: String,
|
||||
pageable: Pageable
|
||||
pageable: Pageable,
|
||||
lang: Lang? = null
|
||||
): GetAudioContentCommentListResponse {
|
||||
val audioContent = audioContentRepository.findByIdOrNull(id = audioContentId)
|
||||
?: return GetAudioContentCommentListResponse(totalCount = 0, items = listOf())
|
||||
@@ -157,7 +164,8 @@ class AudioContentCommentService(
|
||||
isContentCreator = isContentCreator,
|
||||
timezone = timezone,
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize
|
||||
limit = pageable.pageSize,
|
||||
lang = lang
|
||||
)
|
||||
val totalCount = repository.totalCountCommentByContentId(
|
||||
contentId = audioContentId,
|
||||
@@ -172,7 +180,8 @@ class AudioContentCommentService(
|
||||
commentId: Long,
|
||||
memberId: Long,
|
||||
timezone: String,
|
||||
pageable: Pageable
|
||||
pageable: Pageable,
|
||||
lang: Lang? = null
|
||||
): GetAudioContentCommentListResponse {
|
||||
val parentComment = repository.findByIdOrNull(id = commentId)
|
||||
?: return GetAudioContentCommentListResponse(totalCount = 0, items = listOf())
|
||||
@@ -187,7 +196,8 @@ class AudioContentCommentService(
|
||||
memberId = memberId,
|
||||
timezone = timezone,
|
||||
offset = pageable.offset,
|
||||
limit = pageable.pageSize
|
||||
limit = pageable.pageSize,
|
||||
lang = lang
|
||||
)
|
||||
val totalCount = repository.commentReplyCountByAudioContentCommentId(commentId, memberId)
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ import kr.co.vividnext.sodalive.content.main.QGetAudioContentMainItem
|
||||
import kr.co.vividnext.sodalive.content.order.QOrder.order
|
||||
import kr.co.vividnext.sodalive.content.playlist.ContentIdAndEndDateData
|
||||
import kr.co.vividnext.sodalive.content.playlist.QContentIdAndEndDateData
|
||||
import kr.co.vividnext.sodalive.i18n.Lang
|
||||
import kr.co.vividnext.sodalive.member.QMember.member
|
||||
import kr.co.vividnext.sodalive.v2.creatorname.adapter.out.persistence.CreatorNameJoin
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.stereotype.Repository
|
||||
@@ -29,7 +31,8 @@ interface OrderQueryRepository {
|
||||
coverImageHost: String,
|
||||
memberId: Long,
|
||||
offset: Long = 0,
|
||||
limit: Long = 10
|
||||
limit: Long = 10,
|
||||
lang: Lang = Lang.KO
|
||||
): List<GetAudioContentOrderListItem>
|
||||
|
||||
fun totalAudioContentOrderListCount(memberId: Long, dateTime: LocalDateTime): Int
|
||||
@@ -38,12 +41,13 @@ interface OrderQueryRepository {
|
||||
coverImageHost: String,
|
||||
memberId: Long,
|
||||
offset: Long = 0,
|
||||
limit: Long = 20
|
||||
limit: Long = 20,
|
||||
lang: Lang = Lang.KO
|
||||
): List<GetAudioContentMainItem>
|
||||
|
||||
fun findOrderedContent(contentIdList: List<Long>, memberId: Long): List<Long>
|
||||
fun findEndDateByContentId(contentIdList: List<Long>, memberId: Long): List<ContentIdAndEndDateData>
|
||||
fun findBuyerListByContentId(contentId: Long): List<ContentBuyer>
|
||||
fun findBuyerListByContentId(contentId: Long, lang: Lang = Lang.KO): List<ContentBuyer>
|
||||
fun findByMemberIdAndContentId(memberId: Long, contentId: Long, createdAt: LocalDateTime): Order?
|
||||
}
|
||||
|
||||
@@ -134,8 +138,10 @@ class OrderQueryRepositoryImpl(
|
||||
coverImageHost: String,
|
||||
memberId: Long,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
limit: Long,
|
||||
lang: Lang
|
||||
): List<GetAudioContentOrderListItem> {
|
||||
val creatorName = CreatorNameJoin(member, lang, "orderCreatorName")
|
||||
val where = order.member.id.eq(memberId)
|
||||
.and(order.isActive.isTrue)
|
||||
.and(
|
||||
@@ -153,7 +159,7 @@ class OrderQueryRepositoryImpl(
|
||||
audioContent.id,
|
||||
audioContent.coverImage.prepend("/").prepend(coverImageHost),
|
||||
audioContent.member.id,
|
||||
audioContent.member.nickname,
|
||||
creatorName.displayName,
|
||||
audioContent.title,
|
||||
audioContent.theme.theme,
|
||||
audioContent.duration,
|
||||
@@ -165,6 +171,8 @@ class OrderQueryRepositoryImpl(
|
||||
)
|
||||
.from(order)
|
||||
.innerJoin(order.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.leftJoin(creatorName.name).on(creatorName.condition)
|
||||
.where(where)
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
@@ -197,8 +205,10 @@ class OrderQueryRepositoryImpl(
|
||||
coverImageHost: String,
|
||||
memberId: Long,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
limit: Long,
|
||||
lang: Lang
|
||||
): List<GetAudioContentMainItem> {
|
||||
val creatorName = CreatorNameJoin(member, lang, "mainOrderCreatorName")
|
||||
return queryFactory
|
||||
.select(
|
||||
QGetAudioContentMainItem(
|
||||
@@ -209,7 +219,7 @@ class OrderQueryRepositoryImpl(
|
||||
member.profileImage
|
||||
.prepend("/")
|
||||
.prepend(coverImageHost),
|
||||
member.nickname,
|
||||
creatorName.displayName,
|
||||
audioContent.price,
|
||||
audioContent.duration,
|
||||
audioContent.isPointAvailable
|
||||
@@ -218,6 +228,7 @@ class OrderQueryRepositoryImpl(
|
||||
.from(order)
|
||||
.innerJoin(order.audioContent, audioContent)
|
||||
.innerJoin(audioContent.member, member)
|
||||
.leftJoin(creatorName.name).on(creatorName.condition)
|
||||
.where(
|
||||
order.member.id.eq(memberId)
|
||||
.and(order.isActive.isTrue)
|
||||
@@ -266,16 +277,18 @@ class OrderQueryRepositoryImpl(
|
||||
.fetch()
|
||||
}
|
||||
|
||||
override fun findBuyerListByContentId(contentId: Long): List<ContentBuyer> {
|
||||
override fun findBuyerListByContentId(contentId: Long, lang: Lang): List<ContentBuyer> {
|
||||
val creatorName = CreatorNameJoin(member, lang, "contentBuyerName")
|
||||
return queryFactory
|
||||
.select(
|
||||
QContentBuyer(
|
||||
member.nickname,
|
||||
creatorName.displayName,
|
||||
member.profileImage.prepend("/").prepend(imageHost)
|
||||
)
|
||||
)
|
||||
.from(order)
|
||||
.innerJoin(order.member, member)
|
||||
.leftJoin(creatorName.name).on(creatorName.condition)
|
||||
.where(
|
||||
order.isActive.isTrue,
|
||||
order.audioContent.id.eq(contentId),
|
||||
|
||||
@@ -9,6 +9,7 @@ import kr.co.vividnext.sodalive.content.PurchaseOption
|
||||
import kr.co.vividnext.sodalive.content.comment.AudioContentCommentRepository
|
||||
import kr.co.vividnext.sodalive.content.like.AudioContentLikeRepository
|
||||
import kr.co.vividnext.sodalive.content.main.GetAudioContentMainItem
|
||||
import kr.co.vividnext.sodalive.i18n.LangContext
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.point.PointUsageService
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
@@ -26,6 +27,7 @@ class OrderService(
|
||||
private val audioContentCommentQueryRepository: AudioContentCommentRepository,
|
||||
private val audioContentLikeQueryRepository: AudioContentLikeRepository,
|
||||
private val limitedEditionOrderRepository: LimitedEditionOrderRepository,
|
||||
private val langContext: LangContext,
|
||||
|
||||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val audioContentCoverImageHost: String
|
||||
@@ -123,7 +125,8 @@ class OrderService(
|
||||
coverImageHost = audioContentCoverImageHost,
|
||||
memberId = member.id!!,
|
||||
offset = offset,
|
||||
limit = limit
|
||||
limit = limit,
|
||||
lang = langContext.lang
|
||||
)
|
||||
.map {
|
||||
val commentCount = audioContentCommentQueryRepository
|
||||
@@ -154,7 +157,8 @@ class OrderService(
|
||||
coverImageHost = audioContentCoverImageHost,
|
||||
memberId = memberId,
|
||||
offset = 0,
|
||||
limit = 20
|
||||
limit = 20,
|
||||
lang = langContext.lang
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.content.playlist
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.content.AudioContentRepository
|
||||
import kr.co.vividnext.sodalive.content.order.OrderRepository
|
||||
import kr.co.vividnext.sodalive.i18n.LangContext
|
||||
import kr.co.vividnext.sodalive.live.roulette.RedisIdGenerator
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import org.springframework.data.repository.findByIdOrNull
|
||||
@@ -16,7 +17,8 @@ class AudioContentPlaylistService(
|
||||
private val idGenerator: RedisIdGenerator,
|
||||
private val orderRepository: OrderRepository,
|
||||
private val audioContentRepository: AudioContentRepository,
|
||||
private val redisRepository: AudioContentPlaylistRedisRepository
|
||||
private val redisRepository: AudioContentPlaylistRedisRepository,
|
||||
private val langContext: LangContext
|
||||
) {
|
||||
fun createPlaylist(request: CreatePlaylistRequest, member: Member) {
|
||||
if (request.contentIdAndOrderList.size >= 30) {
|
||||
@@ -173,7 +175,8 @@ class AudioContentPlaylistService(
|
||||
}
|
||||
|
||||
val contentList = audioContentRepository.fetchContentForPlaylist(
|
||||
contentIdList = contentIdAndOrderList.map { it.contentId }
|
||||
contentIdList = contentIdAndOrderList.map { it.contentId },
|
||||
lang = langContext.lang
|
||||
)
|
||||
|
||||
val orderMap = contentIdAndOrderList.sortedBy { it.order }
|
||||
|
||||
@@ -112,7 +112,8 @@ class AudioContentThemeService(
|
||||
isAdult = memberContentPreferenceService.isAdultVisibleForQuery(member, isAdultContentVisible),
|
||||
contentType = contentType,
|
||||
offset = offset,
|
||||
limit = limit
|
||||
limit = limit,
|
||||
lang = langContext.lang
|
||||
)
|
||||
|
||||
return GetContentByThemeResponse(
|
||||
|
||||
Reference in New Issue
Block a user