fix: 크리에이터 관리자 콘텐츠 수정 - 태그 수정 기능
- 이미 있는 태그는 다시 추가되지 않도록 추가
This commit is contained in:
parent
5bdb101b52
commit
28427a873a
|
@ -30,6 +30,8 @@ interface CreatorAdminAudioContentQueryRepository {
|
||||||
fun getAudioContent(memberId: Long, audioContentId: Long): AudioContent?
|
fun getAudioContent(memberId: Long, audioContentId: Long): AudioContent?
|
||||||
|
|
||||||
fun findContentHashTagByContentIdAndIsActive(contentId: Long, isActive: Boolean): List<AudioContentHashTag>
|
fun findContentHashTagByContentIdAndIsActive(contentId: Long, isActive: Boolean): List<AudioContentHashTag>
|
||||||
|
|
||||||
|
fun findContentIdAndHashTagId(contentId: Long, hashTagId: Int): AudioContentHashTag?
|
||||||
}
|
}
|
||||||
|
|
||||||
class CreatorAdminAudioContentQueryRepositoryImpl(
|
class CreatorAdminAudioContentQueryRepositoryImpl(
|
||||||
|
@ -145,6 +147,19 @@ class CreatorAdminAudioContentQueryRepositoryImpl(
|
||||||
.fetch()
|
.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(
|
private fun formattedDateExpression(
|
||||||
dateTime: DateTimePath<LocalDateTime>,
|
dateTime: DateTimePath<LocalDateTime>,
|
||||||
format: String = "%Y-%m-%d"
|
format: String = "%Y-%m-%d"
|
||||||
|
|
|
@ -184,7 +184,8 @@ class CreatorAdminContentService(
|
||||||
val hashTag = hashTagRepository.findByTag(tag)
|
val hashTag = hashTagRepository.findByTag(tag)
|
||||||
?: hashTagRepository.save(HashTag(tag))
|
?: hashTagRepository.save(HashTag(tag))
|
||||||
|
|
||||||
val audioContentHashTag = AudioContentHashTag()
|
val audioContentHashTag = repository.findContentIdAndHashTagId(request.id, hashTag.id!!)
|
||||||
|
?: AudioContentHashTag()
|
||||||
audioContentHashTag.audioContent = audioContent
|
audioContentHashTag.audioContent = audioContent
|
||||||
audioContentHashTag.hashTag = hashTag
|
audioContentHashTag.hashTag = hashTag
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue