콘텐츠 상단 고정 기능 추가 #120
|
@ -726,8 +726,16 @@ class AudioContentService(
|
||||||
val audioContent = repository.findByIdAndCreatorId(contentId = contentId, creatorId = member.id!!)
|
val audioContent = repository.findByIdAndCreatorId(contentId = contentId, creatorId = member.id!!)
|
||||||
?: throw SodaException("잘못된 콘텐츠 입니다.\n다시 시도해 주세요.")
|
?: throw SodaException("잘못된 콘텐츠 입니다.\n다시 시도해 주세요.")
|
||||||
|
|
||||||
|
var pinContent = pinContentRepository.findByContentIdAndMemberId(
|
||||||
|
contentId = contentId,
|
||||||
|
memberId = member.id!!
|
||||||
|
)
|
||||||
|
|
||||||
|
if (pinContent != null) {
|
||||||
|
pinContent.isActive = true
|
||||||
|
} else {
|
||||||
val pinContentList = pinContentRepository.getPinContentList(memberId = member.id!!)
|
val pinContentList = pinContentRepository.getPinContentList(memberId = member.id!!)
|
||||||
val pinContent = if (pinContentList.size >= 3) {
|
pinContent = if (pinContentList.size >= 3) {
|
||||||
pinContentList[0]
|
pinContentList[0]
|
||||||
} else {
|
} else {
|
||||||
PinContent()
|
PinContent()
|
||||||
|
@ -737,6 +745,7 @@ class AudioContentService(
|
||||||
pinContent.content = audioContent
|
pinContent.content = audioContent
|
||||||
pinContentRepository.save(pinContent)
|
pinContentRepository.save(pinContent)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun unpinAtTheTop(contentId: Long, member: Member) {
|
fun unpinAtTheTop(contentId: Long, member: Member) {
|
||||||
|
|
Loading…
Reference in New Issue