Compare commits

..

2 Commits

4 changed files with 19 additions and 9 deletions

View File

@ -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()
}

View File

@ -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

View File

@ -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)

View File

@ -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
)