feat(creator-channel): 오디오 탭 controller를 추가한다
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package kr.co.vividnext.sodalive.v2.api.creator.channel.audio.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.audio.application.CreatorChannelAudioFacade
|
||||
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 CreatorChannelAudioController(
|
||||
private val creatorChannelAudioFacade: CreatorChannelAudioFacade
|
||||
) {
|
||||
@GetMapping("/{creatorId}/audio")
|
||||
fun getAudioTab(
|
||||
@PathVariable creatorId: Long,
|
||||
@RequestParam(required = false) sort: String?,
|
||||
@RequestParam(required = false) themeId: Long?,
|
||||
@RequestParam(required = false) page: Int?,
|
||||
@RequestParam(required = false) size: Int?,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
ApiResponse.ok(
|
||||
creatorChannelAudioFacade.getAudioTab(
|
||||
creatorId = creatorId,
|
||||
viewer = requireMember(member),
|
||||
sort = sort,
|
||||
themeId = themeId,
|
||||
page = page,
|
||||
size = size
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun requireMember(member: Member?): Member {
|
||||
return member ?: throw SodaException(messageKey = "common.error.bad_credentials")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user