Compare commits
No commits in common. "febfa442fa92fe4c3b1436be7d529182931a9825" and "858f1a9a329a9776171d8efc718a66c4b51a1698" have entirely different histories.
febfa442fa
...
858f1a9a32
|
@ -593,10 +593,13 @@ class ExplorerQueryRepository(
|
||||||
.fetchFirst()
|
.fetchFirst()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCheers(cheersId: Long): CreatorCheers? {
|
fun getCheers(cheersId: Long, memberId: Long): CreatorCheers? {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(creatorCheers)
|
.selectFrom(creatorCheers)
|
||||||
.where(creatorCheers.id.eq(cheersId))
|
.where(
|
||||||
|
creatorCheers.id.eq(cheersId)
|
||||||
|
.and(creatorCheers.member.id.eq(memberId))
|
||||||
|
)
|
||||||
.fetchFirst()
|
.fetchFirst()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,22 +368,10 @@ class ExplorerService(
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun modifyCheers(request: PutWriteCheersRequest, member: Member) {
|
fun modifyCheers(request: PutWriteCheersRequest, member: Member) {
|
||||||
val cheers = queryRepository.getCheers(request.cheersId)
|
val cheers = queryRepository.getCheers(request.cheersId, member.id!!)
|
||||||
?: throw SodaException("잘못된 요청입니다.")
|
?: throw SodaException("잘못된 요청입니다.")
|
||||||
|
|
||||||
if (cheers.creator!!.id!! != member.id!!) {
|
cheers.cheers = request.content
|
||||||
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
|
@Transactional
|
||||||
|
|
|
@ -13,7 +13,7 @@ import javax.persistence.OneToMany
|
||||||
data class CreatorCheers(
|
data class CreatorCheers(
|
||||||
@Column(columnDefinition = "TEXT", nullable = false)
|
@Column(columnDefinition = "TEXT", nullable = false)
|
||||||
var cheers: String,
|
var cheers: String,
|
||||||
var isActive: Boolean = true
|
val isActive: Boolean = true
|
||||||
) : BaseEntity() {
|
) : BaseEntity() {
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "parent_id", nullable = true)
|
@JoinColumn(name = "parent_id", nullable = true)
|
||||||
|
|
|
@ -2,6 +2,5 @@ package kr.co.vividnext.sodalive.explorer.profile
|
||||||
|
|
||||||
data class PutWriteCheersRequest(
|
data class PutWriteCheersRequest(
|
||||||
val cheersId: Long,
|
val cheersId: Long,
|
||||||
val content: String? = null,
|
val content: String
|
||||||
val isActive: Boolean? = null
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue