feat: 유저 행동 데이터 기록 추가 - 콘텐츠에 댓글 쓰기
This commit is contained in:
@@ -3,6 +3,9 @@ package kr.co.vividnext.sodalive.content.comment
|
||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||
import kr.co.vividnext.sodalive.common.SodaException
|
||||
import kr.co.vividnext.sodalive.member.Member
|
||||
import kr.co.vividnext.sodalive.member.MemberService
|
||||
import kr.co.vividnext.sodalive.useraction.ActionType
|
||||
import kr.co.vividnext.sodalive.useraction.UserActionService
|
||||
import org.springframework.data.domain.Pageable
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
@@ -14,7 +17,11 @@ import org.springframework.web.bind.annotation.RequestParam
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class AudioContentCommentController(private val service: AudioContentCommentService) {
|
||||
class AudioContentCommentController(
|
||||
private val service: AudioContentCommentService,
|
||||
private val memberService: MemberService,
|
||||
private val userActionService: UserActionService
|
||||
) {
|
||||
@PostMapping("/audio-content/comment")
|
||||
fun registerComment(
|
||||
@RequestBody request: RegisterCommentRequest,
|
||||
@@ -22,15 +29,27 @@ class AudioContentCommentController(private val service: AudioContentCommentServ
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
|
||||
ApiResponse.ok(
|
||||
service.registerComment(
|
||||
comment = request.comment,
|
||||
audioContentId = request.contentId,
|
||||
parentId = request.parentId,
|
||||
isSecret = request.isSecret,
|
||||
member = member
|
||||
)
|
||||
service.registerComment(
|
||||
comment = request.comment,
|
||||
audioContentId = request.contentId,
|
||||
parentId = request.parentId,
|
||||
isSecret = request.isSecret,
|
||||
member = member
|
||||
)
|
||||
|
||||
try {
|
||||
val memberId = member.id!!
|
||||
val pushTokenList = memberService.getPushTokenList(recipient = memberId)
|
||||
|
||||
userActionService.recordAction(
|
||||
memberId = member.id!!,
|
||||
actionType = ActionType.CONTENT_COMMENT,
|
||||
pushTokenList = pushTokenList
|
||||
)
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
|
||||
ApiResponse.ok(Unit, "")
|
||||
}
|
||||
|
||||
@PutMapping("/audio-content/comment")
|
||||
|
Reference in New Issue
Block a user