diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentService.kt index 69a6ad4..fb6f527 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentService.kt @@ -67,18 +67,14 @@ class AudioContentCommentService( val audioContentComment = repository.findByIdOrNull(request.commentId) ?: throw SodaException("잘못된 접근 입니다.\n확인 후 다시 시도해 주세요.") - if ( - audioContentComment.member == null || - ( - audioContentComment.member!!.id!! != member.id!! && - audioContentComment.audioContent!!.member!!.id!! != member.id!! - ) - ) { - throw SodaException("잘못된 접근 입니다.\n확인 후 다시 시도해 주세요.") - } + if (audioContentComment.audioContent!!.member!!.id!! != member.id!!) { + if (audioContentComment.member == null || audioContentComment.member!!.id!! != member.id!!) { + throw SodaException("잘못된 접근 입니다.\n확인 후 다시 시도해 주세요.") + } - if (request.comment != null) { - audioContentComment.comment = request.comment + if (request.comment != null) { + audioContentComment.comment = request.comment + } } if (request.isActive != null) { diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt index 5783c1f..419d279 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerQueryRepository.kt @@ -593,13 +593,10 @@ class ExplorerQueryRepository( .fetchFirst() } - fun getCheers(cheersId: Long, memberId: Long): CreatorCheers? { + fun getCheers(cheersId: Long): CreatorCheers? { return queryFactory .selectFrom(creatorCheers) - .where( - creatorCheers.id.eq(cheersId) - .and(creatorCheers.member.id.eq(memberId)) - ) + .where(creatorCheers.id.eq(cheersId)) .fetchFirst() } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt index d64d4df..74ccc70 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/ExplorerService.kt @@ -368,10 +368,22 @@ class ExplorerService( @Transactional fun modifyCheers(request: PutWriteCheersRequest, member: Member) { - val cheers = queryRepository.getCheers(request.cheersId, member.id!!) + val cheers = queryRepository.getCheers(request.cheersId) ?: throw SodaException("잘못된 요청입니다.") - cheers.cheers = request.content + if (cheers.creator!!.id!! != member.id!!) { + if (cheers.member!!.id != member.id!!) { + throw SodaException("잘못된 요청입니다.") + } + + if (request.content != null) { + cheers.cheers = request.content + } + } + + if (request.isActive != null) { + cheers.isActive = request.isActive + } } @Transactional diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/CreatorCheers.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/CreatorCheers.kt index 56aee2e..a7d7e54 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/CreatorCheers.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/CreatorCheers.kt @@ -13,7 +13,7 @@ import javax.persistence.OneToMany data class CreatorCheers( @Column(columnDefinition = "TEXT", nullable = false) var cheers: String, - val isActive: Boolean = true + var isActive: Boolean = true ) : BaseEntity() { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "parent_id", nullable = true) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/PutWriteCheersRequest.kt b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/PutWriteCheersRequest.kt index ebb7209..9be151f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/PutWriteCheersRequest.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/explorer/profile/PutWriteCheersRequest.kt @@ -2,5 +2,6 @@ package kr.co.vividnext.sodalive.explorer.profile data class PutWriteCheersRequest( val cheersId: Long, - val content: String + val content: String? = null, + val isActive: Boolean? = null )