콘텐츠
- 오픈예정인 작품은 새로운 콘텐츠에서 보이지 않도록 수정 - 콘텐츠 상세페이지에 오픈 날짜 추가
This commit is contained in:
parent
9192209ca7
commit
06d670df50
|
@ -56,6 +56,7 @@ interface AudioContentQueryRepository {
|
|||
|
||||
fun findByTheme(
|
||||
cloudfrontHost: String,
|
||||
memberId: Long,
|
||||
theme: String = "",
|
||||
isAdult: Boolean = false,
|
||||
offset: Long = 0,
|
||||
|
@ -64,13 +65,14 @@ interface AudioContentQueryRepository {
|
|||
|
||||
fun findByThemeFor2Weeks(
|
||||
cloudfrontHost: String,
|
||||
memberId: Long,
|
||||
theme: String = "",
|
||||
isAdult: Boolean = false,
|
||||
offset: Long = 0,
|
||||
limit: Long = 20
|
||||
): List<GetAudioContentMainItem>
|
||||
|
||||
fun totalCountNewContentFor2Weeks(theme: String, isAdult: Boolean): Int
|
||||
fun totalCountNewContentFor2Weeks(theme: String, memberId: Long, isAdult: Boolean): Int
|
||||
|
||||
fun getNewContentUploadCreatorList(
|
||||
cloudfrontHost: String,
|
||||
|
@ -242,12 +244,18 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
|
||||
override fun findByTheme(
|
||||
cloudfrontHost: String,
|
||||
memberId: Long,
|
||||
theme: String,
|
||||
isAdult: Boolean,
|
||||
offset: Long,
|
||||
limit: Long
|
||||
): List<GetAudioContentMainItem> {
|
||||
var where = audioContent.isActive.isTrue
|
||||
.and(
|
||||
audioContent.releaseDate.isNull
|
||||
.or(audioContent.releaseDate.loe(LocalDateTime.now()))
|
||||
.or(audioContent.member.id.eq(memberId))
|
||||
)
|
||||
|
||||
if (!isAdult) {
|
||||
where = where.and(audioContent.isAdult.isFalse)
|
||||
|
@ -278,9 +286,14 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
.fetch()
|
||||
}
|
||||
|
||||
override fun totalCountNewContentFor2Weeks(theme: String, isAdult: Boolean): Int {
|
||||
override fun totalCountNewContentFor2Weeks(theme: String, memberId: Long, isAdult: Boolean): Int {
|
||||
var where = audioContent.isActive.isTrue
|
||||
.and(audioContent.createdAt.goe(LocalDateTime.now().minusWeeks(2)))
|
||||
.and(
|
||||
audioContent.releaseDate.isNull
|
||||
.or(audioContent.releaseDate.loe(LocalDateTime.now()))
|
||||
.or(audioContent.member.id.eq(memberId))
|
||||
)
|
||||
|
||||
if (!isAdult) {
|
||||
where = where.and(audioContent.isAdult.isFalse)
|
||||
|
@ -302,6 +315,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
|
||||
override fun findByThemeFor2Weeks(
|
||||
cloudfrontHost: String,
|
||||
memberId: Long,
|
||||
theme: String,
|
||||
isAdult: Boolean,
|
||||
offset: Long,
|
||||
|
@ -309,6 +323,11 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
): List<GetAudioContentMainItem> {
|
||||
var where = audioContent.isActive.isTrue
|
||||
.and(audioContent.createdAt.goe(LocalDateTime.now().minusWeeks(2)))
|
||||
.and(
|
||||
audioContent.releaseDate.isNull
|
||||
.or(audioContent.releaseDate.loe(LocalDateTime.now()))
|
||||
.or(audioContent.member.id.eq(memberId))
|
||||
)
|
||||
|
||||
if (!isAdult) {
|
||||
where = where.and(audioContent.isAdult.isFalse)
|
||||
|
|
|
@ -438,19 +438,41 @@ class AudioContentService(
|
|||
0
|
||||
}
|
||||
|
||||
val audioContentUrl = audioContentCloudFront.generateSignedURL(
|
||||
resourcePath = if (
|
||||
isExistsAudioContent ||
|
||||
isExistsBundleAudioContent ||
|
||||
audioContent.member!!.id!! == member.id!! ||
|
||||
audioContent.price <= 0
|
||||
) {
|
||||
audioContent.content!!
|
||||
} else {
|
||||
audioContent.content!!.replace("output/", "preview/")
|
||||
},
|
||||
expirationTime = 1000 * 60 * 60 * (audioContent.duration!!.split(":")[0].toLong() + 2)
|
||||
)
|
||||
val releaseDate = if (
|
||||
audioContent.releaseDate != null &&
|
||||
audioContent.releaseDate!! < LocalDateTime.now() &&
|
||||
creatorId != member.id!!
|
||||
) {
|
||||
audioContent.releaseDate!!
|
||||
.atZone(ZoneId.of("UTC"))
|
||||
.withZoneSameInstant(ZoneId.of("Asia/Seoul"))
|
||||
.toLocalDateTime()
|
||||
.format(DateTimeFormatter.ofPattern("yyyy년 MM월 dd일 HH시 mm분 오픈"))
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val audioContentUrl = if (
|
||||
audioContent.releaseDate != null &&
|
||||
audioContent.releaseDate!! < LocalDateTime.now() &&
|
||||
creatorId != member.id!!
|
||||
) {
|
||||
audioContentCloudFront.generateSignedURL(
|
||||
resourcePath = if (
|
||||
isExistsAudioContent ||
|
||||
isExistsBundleAudioContent ||
|
||||
audioContent.member!!.id!! == member.id!! ||
|
||||
audioContent.price <= 0
|
||||
) {
|
||||
audioContent.content!!
|
||||
} else {
|
||||
audioContent.content!!.replace("output/", "preview/")
|
||||
},
|
||||
expirationTime = 1000 * 60 * 60 * (audioContent.duration!!.split(":")[0].toLong() + 2)
|
||||
)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
val tag = audioContent.audioContentHashTags
|
||||
.map { it.hashTag!!.tag }
|
||||
|
@ -496,6 +518,7 @@ class AudioContentService(
|
|||
tag = tag,
|
||||
price = audioContent.price,
|
||||
duration = audioContent.duration ?: "",
|
||||
releaseDate = releaseDate,
|
||||
isAdult = audioContent.isAdult,
|
||||
isMosaic = audioContent.isAdult && member.auth == null,
|
||||
isOnlyRental = audioContent.isOnlyRental,
|
||||
|
|
|
@ -14,6 +14,7 @@ data class GetAudioContentDetailResponse(
|
|||
val tag: String,
|
||||
val price: Int,
|
||||
val duration: String,
|
||||
val releaseDate: String?,
|
||||
val isAdult: Boolean,
|
||||
val isMosaic: Boolean,
|
||||
val isOnlyRental: Boolean,
|
||||
|
|
|
@ -33,6 +33,7 @@ class AudioContentMainService(
|
|||
fun getNewContentByTheme(theme: String, member: Member, pageable: Pageable): List<GetAudioContentMainItem> {
|
||||
return repository.findByTheme(
|
||||
cloudfrontHost = imageHost,
|
||||
memberId = member.id!!,
|
||||
theme = theme,
|
||||
isAdult = member.auth != null,
|
||||
offset = pageable.offset,
|
||||
|
@ -45,9 +46,11 @@ class AudioContentMainService(
|
|||
|
||||
@Transactional(readOnly = true)
|
||||
fun getNewContentFor2WeeksByTheme(theme: String, member: Member, pageable: Pageable): GetNewContentAllResponse {
|
||||
val totalCount = repository.totalCountNewContentFor2Weeks(theme, isAdult = member.auth != null)
|
||||
val totalCount =
|
||||
repository.totalCountNewContentFor2Weeks(theme, memberId = member.id!!, isAdult = member.auth != null)
|
||||
val items = repository.findByThemeFor2Weeks(
|
||||
cloudfrontHost = imageHost,
|
||||
memberId = member.id!!,
|
||||
theme = theme,
|
||||
isAdult = member.auth != null,
|
||||
offset = pageable.offset,
|
||||
|
|
Loading…
Reference in New Issue