feat(creator): 채널 라이브 탭 조회 API를 추가한다

This commit is contained in:
2026-06-17 20:19:48 +09:00
parent f78772b613
commit 85a331c28d
2 changed files with 259 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package kr.co.vividnext.sodalive.v2.api.creator.channel.live.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.live.application.CreatorChannelLiveFacade
import kr.co.vividnext.sodalive.v2.common.domain.ContentSort
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 CreatorChannelLiveController(
private val creatorChannelLiveFacade: CreatorChannelLiveFacade
) {
@GetMapping("/{creatorId}/live")
fun getLiveTab(
@PathVariable creatorId: Long,
@RequestParam(defaultValue = "LATEST") sort: ContentSort,
@RequestParam(defaultValue = "0") page: Int,
@RequestParam(defaultValue = "20") size: Int,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
ApiResponse.ok(
creatorChannelLiveFacade.getLiveTab(
creatorId = creatorId,
viewer = requireMember(member),
sort = sort,
page = page,
size = size
)
)
}
private fun requireMember(member: Member?): Member {
return member ?: throw SodaException(messageKey = "common.error.bad_credentials")
}
}