feat(explorer): 크리에이터 프로필에 최신/총/소장 콘텐츠 정보 추가
- ExplorerService.getCreatorProfile에서 다음 정보 계산/반환 - 최신 오디오 콘텐츠 1개(`latestContent`) - 전체 콘텐츠 수(`totalContentCount`) - 조회 유저의 소장 콘텐츠 수(`ownedContentCount`) - ExplorerQueryRepository.getOwnedContentCount 추가 - 활성 KEEP 또는 유효한 RENTAL 주문 기준으로 distinct 카운트 - GetCreatorProfileResponse 스키마 확장 - `latestContent`, `totalContentCount`, `ownedContentCount` 필드 추가 - AudioContentService.getLatestCreatorAudioContent 사용해 최신 콘텐츠 조회 로직 보강 - 성인 콘텐츠 노출 여부 및 구매/대여 상태 반영 - OrderRepository의 주문 타입 조회 로직을 활용해 보유/대여 상태 표시 API 응답 필드가 추가되어 프로필 화면 구성 정보를 보강합니다. (호환성 유지)
This commit is contained in:
@@ -386,7 +386,7 @@ class AudioContentService(
|
||||
|
||||
// Check if the time difference is greater than 30 seconds (30000 milliseconds)
|
||||
return date2.time - date1.time
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
// Handle invalid time formats or parsing errors
|
||||
return 0
|
||||
}
|
||||
@@ -749,6 +749,49 @@ class AudioContentService(
|
||||
)
|
||||
}
|
||||
|
||||
fun getLatestCreatorAudioContent(
|
||||
creatorId: Long,
|
||||
member: Member,
|
||||
isAdultContentVisible: Boolean
|
||||
): GetAudioContentListItem? {
|
||||
val isAdult = member.auth != null && isAdultContentVisible
|
||||
|
||||
val audioContent = repository.findLatestContentByCreatorId(creatorId, isAdult) ?: return null
|
||||
|
||||
val commentCount = commentRepository
|
||||
.totalCountCommentByContentId(
|
||||
audioContent.id!!,
|
||||
memberId = member.id!!,
|
||||
isContentCreator = creatorId == member.id!!
|
||||
)
|
||||
|
||||
val likeCount = audioContentLikeRepository
|
||||
.totalCountAudioContentLike(audioContent.id!!)
|
||||
|
||||
val (isExistsAudioContent, orderType) = orderRepository.isExistOrderedAndOrderType(
|
||||
memberId = member.id!!,
|
||||
contentId = audioContent.id!!
|
||||
)
|
||||
|
||||
return GetAudioContentListItem(
|
||||
contentId = audioContent.id!!,
|
||||
coverImageUrl = "$coverImageHost/${audioContent.coverImage}",
|
||||
title = audioContent.title,
|
||||
price = audioContent.price,
|
||||
themeStr = audioContent.theme!!.theme,
|
||||
duration = audioContent.duration,
|
||||
likeCount = likeCount,
|
||||
commentCount = commentCount,
|
||||
isPin = false,
|
||||
isAdult = audioContent.isAdult,
|
||||
isScheduledToOpen = audioContent.releaseDate != null && audioContent.releaseDate!! >= LocalDateTime.now(),
|
||||
isRented = isExistsAudioContent && orderType == OrderType.RENTAL,
|
||||
isOwned = isExistsAudioContent && orderType == OrderType.KEEP,
|
||||
isSoldOut = audioContent.remaining != null && audioContent.remaining!! <= 0,
|
||||
isPointAvailable = audioContent.isPointAvailable
|
||||
)
|
||||
}
|
||||
|
||||
fun getAudioContentList(
|
||||
creatorId: Long,
|
||||
sortType: SortType,
|
||||
|
||||
Reference in New Issue
Block a user