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