From 6df043dfac15f798469d768409773c60dfe1c959 Mon Sep 17 00:00:00 2001 From: Klaus Date: Mon, 19 May 2025 15:05:31 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=8C=93?= =?UTF-8?q?=EA=B8=80=20=EC=9E=91=EC=84=B1=EC=8B=9C=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=ED=96=89=EB=8F=99=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EC=97=90=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20ID=EB=A5=BC=20=EA=B0=99=EC=9D=B4=20?= =?UTF-8?q?=EA=B8=B0=EB=A1=9D=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/comment/AudioContentCommentController.kt | 4 +++- .../content/comment/AudioContentCommentService.kt | 6 ++++-- .../kr/co/vividnext/sodalive/useraction/UserActionLog.kt | 3 ++- .../vividnext/sodalive/useraction/UserActionService.kt | 9 ++++++++- 4 files changed, 17 insertions(+), 5 deletions(-) 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() }