feat(creator-channel): FanTalk 탭 endpoint를 추가한다

This commit is contained in:
2026-06-22 14:51:52 +09:00
parent 90bf4c770c
commit 0ebb686ce6
2 changed files with 205 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
package kr.co.vividnext.sodalive.v2.api.creator.channel.fantalk.adapter.`in`.web
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.v2.api.creator.channel.fantalk.application.CreatorChannelFanTalkFacade
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/api/v2/creator-channels")
class CreatorChannelFanTalkController(
private val creatorChannelFanTalkFacade: CreatorChannelFanTalkFacade
) {
@GetMapping("/{creatorId}/fan-talks")
fun getFanTalkTab(
@PathVariable creatorId: Long,
@RequestParam(required = false) page: Int?,
@RequestParam(required = false) size: Int?,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
ApiResponse.ok(
creatorChannelFanTalkFacade.getFanTalkTab(
creatorId = creatorId,
viewer = requireMember(member),
page = page,
size = size
)
)
}
private fun requireMember(member: Member?): Member {
return member ?: throw SodaException(messageKey = "common.error.bad_credentials")
}
}