feat(content): 콘텐츠 전체보기 endpoint를 추가한다

This commit is contained in:
2026-06-27 06:41:47 +09:00
parent 4e2b63acf4
commit 686bd2c987
2 changed files with 136 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package kr.co.vividnext.sodalive.v2.api.content.overview.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.content.overview.application.ContentOverviewFacade
import org.springframework.security.core.annotation.AuthenticationPrincipal
import org.springframework.web.bind.annotation.GetMapping
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/contents")
class ContentOverviewController(
private val facade: ContentOverviewFacade
) {
@GetMapping
fun getContents(
@RequestParam(required = false) type: String?,
@RequestParam(required = false) page: Int?,
@RequestParam(required = false) size: Int?,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
ApiResponse.ok(facade.getContents(type, page, size, requireMember(member)))
}
private fun requireMember(member: Member?): Member {
return member ?: throw SodaException(messageKey = "common.error.bad_credentials")
}
}