diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentController.kt index b3e4ad3..6adb6cc 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentController.kt @@ -29,7 +29,7 @@ class AudioContentCommentController( ) = run { if (member == null) throw SodaException("로그인 정보를 확인해주세요.") - service.registerComment( + val commentId = service.registerComment( comment = request.comment, audioContentId = request.contentId, parentId = request.parentId, @@ -44,6 +44,7 @@ class AudioContentCommentController( userActionService.recordAction( memberId = member.id!!, actionType = ActionType.CONTENT_COMMENT, + commentId = commentId, pushTokenList = pushTokenList ) @@ -51,6 +52,7 @@ class AudioContentCommentController( memberId = member.id!!, actionType = ActionType.ORDER_CONTENT_COMMENT, contentId = request.contentId, + commentId = commentId, pushTokenList = pushTokenList ) } catch (_: Exception) { diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentService.kt index 9d885c1..90b9be7 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/comment/AudioContentCommentService.kt @@ -33,7 +33,7 @@ class AudioContentCommentService( audioContentId: Long, parentId: Long? = null, isSecret: Boolean = false - ) { + ): Long { val audioContent = audioContentRepository.findByIdOrNull(id = audioContentId) ?: throw SodaException("잘못된 콘텐츠 입니다.\n다시 시도해 주세요.") @@ -64,7 +64,7 @@ class AudioContentCommentService( audioContentComment.parent = parent } - repository.save(audioContentComment) + val savedContentComment = repository.save(audioContentComment) applicationEventPublisher.publishEvent( FcmEvent( @@ -84,6 +84,8 @@ class AudioContentCommentService( myMemberId = member.id ) ) + + return savedContentComment.id!! } @Transactional diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/useraction/UserActionLog.kt b/src/main/kotlin/kr/co/vividnext/sodalive/useraction/UserActionLog.kt index fc92561..c7ae5cc 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/useraction/UserActionLog.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/useraction/UserActionLog.kt @@ -9,5 +9,6 @@ import javax.persistence.Enumerated data class UserActionLog( val memberId: Long, @Enumerated(EnumType.STRING) - val actionType: ActionType + val actionType: ActionType, + val commentId: Long? = null ) : BaseEntity() diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/useraction/UserActionService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/useraction/UserActionService.kt index 0efefc5..8e8d913 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/useraction/UserActionService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/useraction/UserActionService.kt @@ -33,12 +33,19 @@ class UserActionService( memberId: Long, actionType: ActionType, contentId: Long? = null, + commentId: Long? = null, pushTokenList: List = emptyList() ) { coroutineScope.launch { val now = LocalDateTime.now() transactionTemplate.execute { - repository.save(UserActionLog(memberId, actionType)) + repository.save( + UserActionLog( + memberId = memberId, + actionType = actionType, + commentId = commentId + ) + ) repository.flush() }