refactor: 메인 페이지 & 예약 페이지에서 테마 상세 조회는 Public으로 권한 변경

This commit is contained in:
이상진 2025-09-13 16:04:58 +09:00
parent 905c4b7019
commit 1d41d517b1
2 changed files with 5 additions and 49 deletions

View File

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestBody
import roomescape.admin.infrastructure.persistence.Privilege import roomescape.admin.infrastructure.persistence.Privilege
import roomescape.auth.web.support.AdminOnly import roomescape.auth.web.support.AdminOnly
import roomescape.auth.web.support.UserOnly import roomescape.auth.web.support.Public
import roomescape.common.dto.response.CommonApiResponse import roomescape.common.dto.response.CommonApiResponse
import roomescape.theme.web.* import roomescape.theme.web.*
@ -45,13 +45,13 @@ interface ThemeAPIV2 {
@Valid @RequestBody themeUpdateRequest: ThemeUpdateRequest @Valid @RequestBody themeUpdateRequest: ThemeUpdateRequest
): ResponseEntity<CommonApiResponse<Unit>> ): ResponseEntity<CommonApiResponse<Unit>>
@UserOnly @Public
@Operation(summary = "예약 페이지에서 모든 테마 조회", description = "모든 테마를 조회합니다.", tags = ["로그인이 필요한 API"]) @Operation(summary = "예약 페이지에서 모든 테마 조회", description = "모든 테마를 조회합니다.")
@ApiResponses(ApiResponse(responseCode = "200", description = "성공", useReturnTypeSchema = true)) @ApiResponses(ApiResponse(responseCode = "200", description = "성공", useReturnTypeSchema = true))
fun findUserThemes(): ResponseEntity<CommonApiResponse<ThemeInfoListRetrieveResponse>> fun findUserThemes(): ResponseEntity<CommonApiResponse<ThemeInfoListRetrieveResponse>>
@UserOnly @Public
@Operation(summary = "예약 페이지에서 입력한 날짜에 가능한 테마 조회", description = "입력한 날짜에 가능한 테마를 조회합니다.", tags = ["로그인이 필요한 API"]) @Operation(summary = "예약 페이지에서 입력한 날짜에 가능한 테마 조회", description = "입력한 날짜에 가능한 테마를 조회합니다.")
@ApiResponses(ApiResponse(responseCode = "200", description = "성공", useReturnTypeSchema = true)) @ApiResponses(ApiResponse(responseCode = "200", description = "성공", useReturnTypeSchema = true))
fun findThemesByIds(request: ThemeIdListRetrieveResponse): ResponseEntity<CommonApiResponse<ThemeInfoListRetrieveResponse>> fun findThemesByIds(request: ThemeIdListRetrieveResponse): ResponseEntity<CommonApiResponse<ThemeInfoListRetrieveResponse>>
} }

View File

@ -283,29 +283,6 @@ class ThemeApiTest(
} }
context("입력된 모든 ID에 대한 테마를 조회한다.") { context("입력된 모든 ID에 대한 테마를 조회한다.") {
val endpoint = "/themes/retrieve"
context("권한이 없으면 접근할 수 없다.") {
test("비회원") {
runExceptionTest(
method = HttpMethod.POST,
requestBody = ThemeIdListRetrieveResponse(themeIds = listOf()),
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.TOKEN_NOT_FOUND
)
}
test("관리자") {
runExceptionTest(
token = authUtil.defaultAdminLogin(),
method = HttpMethod.POST,
requestBody = ThemeIdListRetrieveResponse(themeIds = listOf()),
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.ACCESS_DENIED
)
}
}
test("정상 응답") { test("정상 응답") {
val adminToken = authUtil.defaultAdminLogin() val adminToken = authUtil.defaultAdminLogin()
val themeSize = 3 val themeSize = 3
@ -406,27 +383,6 @@ class ThemeApiTest(
} }
context("예약 페이지에서 테마를 조회한다.") { context("예약 페이지에서 테마를 조회한다.") {
val endpoint = "/v2/themes"
context("권한이 없으면 접근할 수 없다.") {
test("비회원") {
runExceptionTest(
method = HttpMethod.GET,
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.TOKEN_NOT_FOUND
)
}
test("관리자") {
runExceptionTest(
token = authUtil.defaultAdminLogin(),
method = HttpMethod.GET,
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.ACCESS_DENIED
)
}
}
test("공개된 테마의 전체 정보가 조회된다.") { test("공개된 테마의 전체 정보가 조회된다.") {
val token = authUtil.defaultAdminLogin() val token = authUtil.defaultAdminLogin()
listOf( listOf(