AudioContent 조회 API에서 api 마다 languageCode를 별도로 받던 것을 LangContext를 사용하도록 리팩토링

This commit is contained in:
2025-12-12 19:40:21 +09:00
parent 165640201f
commit 59949e5aee
3 changed files with 33 additions and 53 deletions

View File

@@ -108,7 +108,6 @@ class AudioContentController(private val service: AudioContentService) {
@RequestParam("category-id", required = false) categoryId: Long? = 0,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@RequestParam("languageCode", required = false) languageCode: String? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
pageable: Pageable
) = run {
@@ -121,7 +120,6 @@ class AudioContentController(private val service: AudioContentService) {
categoryId = categoryId ?: 0,
isAdultContentVisible = isAdultContentVisible ?: true,
contentType = contentType ?: ContentType.ALL,
languageCode = languageCode,
member = member,
offset = pageable.offset,
limit = pageable.pageSize.toLong()
@@ -133,7 +131,6 @@ class AudioContentController(private val service: AudioContentService) {
fun getDetail(
@PathVariable id: Long,
@RequestParam timezone: String,
@RequestParam(required = false) languageCode: String? = null,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
) = run {
@@ -144,8 +141,7 @@ class AudioContentController(private val service: AudioContentService) {
id = id,
member = member,
isAdultContentVisible = isAdultContentVisible ?: true,
timezone = timezone,
languageCode = languageCode
timezone = timezone
)
)
}
@@ -243,7 +239,6 @@ class AudioContentController(private val service: AudioContentService) {
@GetMapping("/all")
fun getAllContents(
@RequestParam("languageCode", required = false) languageCode: String? = null,
@RequestParam("isAdultContentVisible", required = false) isAdultContentVisible: Boolean? = null,
@RequestParam("contentType", required = false) contentType: ContentType? = null,
@RequestParam("isFree", required = false) isFree: Boolean? = null,
@@ -264,8 +259,7 @@ class AudioContentController(private val service: AudioContentService) {
sortType = sortType ?: SortType.NEWEST,
isFree = isFree ?: false,
isAdult = (isAdultContentVisible ?: true) && member.auth != null,
isPointAvailableOnly = isPointAvailableOnly ?: false,
languageCode = languageCode
isPointAvailableOnly = isPointAvailableOnly ?: false
)
)
}