test #316
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -33,12 +33,19 @@ class UserActionService(
|
|||
memberId: Long,
|
||||
actionType: ActionType,
|
||||
contentId: Long? = null,
|
||||
commentId: Long? = null,
|
||||
pushTokenList: List<String> = 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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue