Compare commits
2 Commits
858f1a9a32
...
febfa442fa
Author | SHA1 | Date |
---|---|---|
|
febfa442fa | |
|
27f4d78f0d |
|
@ -593,13 +593,10 @@ class ExplorerQueryRepository(
|
||||||
.fetchFirst()
|
.fetchFirst()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCheers(cheersId: Long, memberId: Long): CreatorCheers? {
|
fun getCheers(cheersId: Long): CreatorCheers? {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(creatorCheers)
|
.selectFrom(creatorCheers)
|
||||||
.where(
|
.where(creatorCheers.id.eq(cheersId))
|
||||||
creatorCheers.id.eq(cheersId)
|
|
||||||
.and(creatorCheers.member.id.eq(memberId))
|
|
||||||
)
|
|
||||||
.fetchFirst()
|
.fetchFirst()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,10 +368,22 @@ class ExplorerService(
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun modifyCheers(request: PutWriteCheersRequest, member: Member) {
|
fun modifyCheers(request: PutWriteCheersRequest, member: Member) {
|
||||||
val cheers = queryRepository.getCheers(request.cheersId, member.id!!)
|
val cheers = queryRepository.getCheers(request.cheersId)
|
||||||
?: throw SodaException("잘못된 요청입니다.")
|
?: 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
|
@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,
|
||||||
val isActive: Boolean = true
|
var 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,5 +2,6 @@ package kr.co.vividnext.sodalive.explorer.profile
|
||||||
|
|
||||||
data class PutWriteCheersRequest(
|
data class PutWriteCheersRequest(
|
||||||
val cheersId: Long,
|
val cheersId: Long,
|
||||||
val content: String
|
val content: String? = null,
|
||||||
|
val isActive: Boolean? = null
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue