응원글 - 응원글 삭제로직 추가
This commit is contained in:
parent
27f4d78f0d
commit
febfa442fa
|
@ -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) {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue