Compare commits
No commits in common. "dcbe57806c66e1d0ad5a1f7efde929cac0b1181f" and "b14438cc15788c1bc5fa25a7fb164c60ae4f7dc4" have entirely different histories.
dcbe57806c
...
b14438cc15
|
@ -140,7 +140,6 @@ class AdminAudioContentQueryRepositoryImpl(
|
|||
audioContent.duration.isNotNull
|
||||
.and(audioContent.member.isNotNull)
|
||||
.and(audioContentHashTag.audioContent.id.eq(audioContentId))
|
||||
.and(audioContentHashTag.isActive.isTrue)
|
||||
)
|
||||
.fetch()
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.querydsl.core.types.dsl.StringTemplate
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import kr.co.vividnext.sodalive.content.AudioContent
|
||||
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
||||
import kr.co.vividnext.sodalive.content.hashtag.AudioContentHashTag
|
||||
import kr.co.vividnext.sodalive.content.hashtag.QAudioContentHashTag.audioContentHashTag
|
||||
import kr.co.vividnext.sodalive.content.hashtag.QHashTag.hashTag
|
||||
import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme
|
||||
|
@ -28,10 +27,6 @@ interface CreatorAdminAudioContentQueryRepository {
|
|||
fun getHashTagList(audioContentId: Long): List<String>
|
||||
|
||||
fun getAudioContent(memberId: Long, audioContentId: Long): AudioContent?
|
||||
|
||||
fun findContentHashTagByContentIdAndIsActive(contentId: Long, isActive: Boolean): List<AudioContentHashTag>
|
||||
|
||||
fun findContentIdAndHashTagId(contentId: Long, hashTagId: Int): AudioContentHashTag?
|
||||
}
|
||||
|
||||
class CreatorAdminAudioContentQueryRepositoryImpl(
|
||||
|
@ -116,7 +111,6 @@ class CreatorAdminAudioContentQueryRepositoryImpl(
|
|||
audioContent.duration.isNotNull
|
||||
.and(audioContent.member.isNotNull)
|
||||
.and(audioContentHashTag.audioContent.id.eq(audioContentId))
|
||||
.and(audioContentHashTag.isActive.isTrue)
|
||||
)
|
||||
.fetch()
|
||||
}
|
||||
|
@ -133,33 +127,6 @@ class CreatorAdminAudioContentQueryRepositoryImpl(
|
|||
.fetchFirst()
|
||||
}
|
||||
|
||||
override fun findContentHashTagByContentIdAndIsActive(
|
||||
contentId: Long,
|
||||
isActive: Boolean
|
||||
): List<AudioContentHashTag> {
|
||||
return queryFactory
|
||||
.selectFrom(audioContentHashTag)
|
||||
.innerJoin(audioContentHashTag.audioContent, audioContent)
|
||||
.where(
|
||||
audioContentHashTag.isActive.eq(isActive)
|
||||
.and(audioContent.id.eq(contentId))
|
||||
)
|
||||
.fetch()
|
||||
}
|
||||
|
||||
override fun findContentIdAndHashTagId(contentId: Long, hashTagId: Int): AudioContentHashTag? {
|
||||
return queryFactory
|
||||
.selectFrom(audioContentHashTag)
|
||||
.innerJoin(audioContentHashTag.audioContent, audioContent)
|
||||
.innerJoin(audioContentHashTag.hashTag, hashTag)
|
||||
.where(
|
||||
audioContent.id.eq(contentId),
|
||||
hashTag.id.eq(hashTagId)
|
||||
)
|
||||
.orderBy(audioContentHashTag.id.asc())
|
||||
.fetchFirst()
|
||||
}
|
||||
|
||||
private fun formattedDateExpression(
|
||||
dateTime: DateTimePath<LocalDateTime>,
|
||||
format: String = "%Y-%m-%d"
|
||||
|
|
|
@ -7,9 +7,6 @@ import kr.co.vividnext.sodalive.aws.s3.S3Uploader
|
|||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.content.ContentPriceChangeLog
|
||||
import kr.co.vividnext.sodalive.content.ContentPriceChangeLogRepository
|
||||
import kr.co.vividnext.sodalive.content.hashtag.AudioContentHashTag
|
||||
import kr.co.vividnext.sodalive.content.hashtag.HashTag
|
||||
import kr.co.vividnext.sodalive.content.hashtag.HashTagRepository
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.utils.generateFileName
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
|
@ -21,7 +18,6 @@ import org.springframework.web.multipart.MultipartFile
|
|||
@Service
|
||||
class CreatorAdminContentService(
|
||||
private val repository: CreatorAdminContentRepository,
|
||||
private val hashTagRepository: HashTagRepository,
|
||||
private val contentPriceChangeLogRepository: ContentPriceChangeLogRepository,
|
||||
private val audioContentCloudFront: AudioContentCloudFront,
|
||||
private val objectMapper: ObjectMapper,
|
||||
|
@ -160,40 +156,5 @@ class CreatorAdminContentService(
|
|||
|
||||
audioContent.price = request.price
|
||||
}
|
||||
|
||||
if (!request.tags.isNullOrBlank()) {
|
||||
val normalizedTags = request.tags
|
||||
.replace("#", " #")
|
||||
.split(" ")
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotBlank() }
|
||||
.map { if (it.startsWith("#")) it else "#$it" }
|
||||
.distinct()
|
||||
|
||||
val currentContentTags = repository.findContentHashTagByContentIdAndIsActive(request.id, true)
|
||||
val currentTagMap = currentContentTags.associateBy { it.hashTag!!.tag }
|
||||
|
||||
val tagsToAdd = normalizedTags.subtract(currentTagMap.keys)
|
||||
val tagsToDeactivate = currentTagMap.keys.subtract(normalizedTags.toSet())
|
||||
|
||||
tagsToDeactivate.forEach {
|
||||
currentTagMap[it]?.let { cht -> cht.isActive = false }
|
||||
}
|
||||
|
||||
val newAudioContentHashTagList = tagsToAdd.map { tag ->
|
||||
val hashTag = hashTagRepository.findByTag(tag)
|
||||
?: hashTagRepository.save(HashTag(tag))
|
||||
|
||||
val audioContentHashTag = repository.findContentIdAndHashTagId(request.id, hashTag.id!!)
|
||||
?: AudioContentHashTag()
|
||||
audioContentHashTag.audioContent = audioContent
|
||||
audioContentHashTag.hashTag = hashTag
|
||||
audioContentHashTag.isActive = true
|
||||
|
||||
audioContentHashTag
|
||||
}
|
||||
|
||||
audioContent.audioContentHashTags.addAll(newAudioContentHashTagList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ data class UpdateCreatorAdminContentRequest(
|
|||
val id: Long,
|
||||
val title: String?,
|
||||
val detail: String?,
|
||||
val tags: String?,
|
||||
val price: Int?,
|
||||
val isAdult: Boolean?,
|
||||
val isActive: Boolean?,
|
||||
|
|
Loading…
Reference in New Issue