fix: 콘텐츠 댓글 작성시 유저 행동 데이터에 댓글 ID를 같이 기록하도록 수정
This commit is contained in:
parent
fe84292483
commit
6df043dfac
|
@ -29,7 +29,7 @@ class AudioContentCommentController(
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||||
|
|
||||||
service.registerComment(
|
val commentId = service.registerComment(
|
||||||
comment = request.comment,
|
comment = request.comment,
|
||||||
audioContentId = request.contentId,
|
audioContentId = request.contentId,
|
||||||
parentId = request.parentId,
|
parentId = request.parentId,
|
||||||
|
@ -44,6 +44,7 @@ class AudioContentCommentController(
|
||||||
userActionService.recordAction(
|
userActionService.recordAction(
|
||||||
memberId = member.id!!,
|
memberId = member.id!!,
|
||||||
actionType = ActionType.CONTENT_COMMENT,
|
actionType = ActionType.CONTENT_COMMENT,
|
||||||
|
commentId = commentId,
|
||||||
pushTokenList = pushTokenList
|
pushTokenList = pushTokenList
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ class AudioContentCommentController(
|
||||||
memberId = member.id!!,
|
memberId = member.id!!,
|
||||||
actionType = ActionType.ORDER_CONTENT_COMMENT,
|
actionType = ActionType.ORDER_CONTENT_COMMENT,
|
||||||
contentId = request.contentId,
|
contentId = request.contentId,
|
||||||
|
commentId = commentId,
|
||||||
pushTokenList = pushTokenList
|
pushTokenList = pushTokenList
|
||||||
)
|
)
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class AudioContentCommentService(
|
||||||
audioContentId: Long,
|
audioContentId: Long,
|
||||||
parentId: Long? = null,
|
parentId: Long? = null,
|
||||||
isSecret: Boolean = false
|
isSecret: Boolean = false
|
||||||
) {
|
): Long {
|
||||||
val audioContent = audioContentRepository.findByIdOrNull(id = audioContentId)
|
val audioContent = audioContentRepository.findByIdOrNull(id = audioContentId)
|
||||||
?: throw SodaException("잘못된 콘텐츠 입니다.\n다시 시도해 주세요.")
|
?: throw SodaException("잘못된 콘텐츠 입니다.\n다시 시도해 주세요.")
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class AudioContentCommentService(
|
||||||
audioContentComment.parent = parent
|
audioContentComment.parent = parent
|
||||||
}
|
}
|
||||||
|
|
||||||
repository.save(audioContentComment)
|
val savedContentComment = repository.save(audioContentComment)
|
||||||
|
|
||||||
applicationEventPublisher.publishEvent(
|
applicationEventPublisher.publishEvent(
|
||||||
FcmEvent(
|
FcmEvent(
|
||||||
|
@ -84,6 +84,8 @@ class AudioContentCommentService(
|
||||||
myMemberId = member.id
|
myMemberId = member.id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return savedContentComment.id!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
|
@ -9,5 +9,6 @@ import javax.persistence.Enumerated
|
||||||
data class UserActionLog(
|
data class UserActionLog(
|
||||||
val memberId: Long,
|
val memberId: Long,
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
val actionType: ActionType
|
val actionType: ActionType,
|
||||||
|
val commentId: Long? = null
|
||||||
) : BaseEntity()
|
) : BaseEntity()
|
||||||
|
|
|
@ -33,12 +33,19 @@ class UserActionService(
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
actionType: ActionType,
|
actionType: ActionType,
|
||||||
contentId: Long? = null,
|
contentId: Long? = null,
|
||||||
|
commentId: Long? = null,
|
||||||
pushTokenList: List<String> = emptyList()
|
pushTokenList: List<String> = emptyList()
|
||||||
) {
|
) {
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
val now = LocalDateTime.now()
|
val now = LocalDateTime.now()
|
||||||
transactionTemplate.execute {
|
transactionTemplate.execute {
|
||||||
repository.save(UserActionLog(memberId, actionType))
|
repository.save(
|
||||||
|
UserActionLog(
|
||||||
|
memberId = memberId,
|
||||||
|
actionType = actionType,
|
||||||
|
commentId = commentId
|
||||||
|
)
|
||||||
|
)
|
||||||
repository.flush()
|
repository.flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue