Compare commits

..

No commits in common. "febfa442fa92fe4c3b1436be7d529182931a9825" and "858f1a9a329a9776171d8efc718a66c4b51a1698" have entirely different histories.

4 changed files with 9 additions and 19 deletions

View File

@ -593,10 +593,13 @@ class ExplorerQueryRepository(
.fetchFirst()
}
fun getCheers(cheersId: Long): CreatorCheers? {
fun getCheers(cheersId: Long, memberId: Long): CreatorCheers? {
return queryFactory
.selectFrom(creatorCheers)
.where(creatorCheers.id.eq(cheersId))
.where(
creatorCheers.id.eq(cheersId)
.and(creatorCheers.member.id.eq(memberId))
)
.fetchFirst()
}

View File

@ -368,23 +368,11 @@ class ExplorerService(
@Transactional
fun modifyCheers(request: PutWriteCheersRequest, member: Member) {
val cheers = queryRepository.getCheers(request.cheersId)
val cheers = queryRepository.getCheers(request.cheersId, member.id!!)
?: throw SodaException("잘못된 요청입니다.")
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
fun saveNotice(member: Member, notice: String) {

View File

@ -13,7 +13,7 @@ import javax.persistence.OneToMany
data class CreatorCheers(
@Column(columnDefinition = "TEXT", nullable = false)
var cheers: String,
var isActive: Boolean = true
val isActive: Boolean = true
) : BaseEntity() {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "parent_id", nullable = true)

View File

@ -2,6 +2,5 @@ package kr.co.vividnext.sodalive.explorer.profile
data class PutWriteCheersRequest(
val cheersId: Long,
val content: String? = null,
val isActive: Boolean? = null
val content: String
)