refactor: 예약 페이지에서의 일정 정보 조회는 비회원도 가능하도록 수정

This commit is contained in:
이상진 2025-09-13 18:31:41 +09:00
parent 0bcb90f812
commit e8ed273943
2 changed files with 5 additions and 44 deletions

View File

@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RequestParam
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.Public
import roomescape.auth.web.support.UserOnly import roomescape.auth.web.support.UserOnly
import roomescape.common.dto.response.CommonApiResponse import roomescape.common.dto.response.CommonApiResponse
import roomescape.schedule.web.* import roomescape.schedule.web.*
@ -18,15 +19,15 @@ import java.time.LocalDate
interface ScheduleAPI { interface ScheduleAPI {
@UserOnly @Public
@Operation(summary = "입력된 날짜에 가능한 테마 목록 조회", tags = ["로그인이 필요한 API"]) @Operation(summary = "입력된 날짜에 가능한 테마 목록 조회")
@ApiResponses(ApiResponse(responseCode = "200", description = "입력된 날짜에 가능한 테마 목록 조회", useReturnTypeSchema = true)) @ApiResponses(ApiResponse(responseCode = "200", description = "입력된 날짜에 가능한 테마 목록 조회", useReturnTypeSchema = true))
fun findAvailableThemes( fun findAvailableThemes(
@RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd") date: LocalDate @RequestParam("date") @DateTimeFormat(pattern = "yyyy-MM-dd") date: LocalDate
): ResponseEntity<CommonApiResponse<AvailableThemeIdListResponse>> ): ResponseEntity<CommonApiResponse<AvailableThemeIdListResponse>>
@UserOnly @Public
@Operation(summary = "입력된 날짜, 테마에 대한 모든 시간 조회", tags = ["로그인이 필요한 API"]) @Operation(summary = "입력된 날짜, 테마에 대한 모든 시간 조회")
@ApiResponses( @ApiResponses(
ApiResponse( ApiResponse(
responseCode = "200", responseCode = "200",

View File

@ -31,25 +31,6 @@ class ScheduleApiTest(
val date = LocalDate.now().plusDays(1) val date = LocalDate.now().plusDays(1)
val endpoint = "/schedules/themes?date=$date" val endpoint = "/schedules/themes?date=$date"
context("권한이 없으면 접근할 수 없다.") {
test("관리자") {
runExceptionTest(
token = authUtil.defaultAdminLogin(),
method = HttpMethod.GET,
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.ACCESS_DENIED
)
}
test("비회원") {
runExceptionTest(
method = HttpMethod.GET,
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.TOKEN_NOT_FOUND
)
}
}
test("정상 응답") { test("정상 응답") {
val adminToken = authUtil.defaultAdminLogin() val adminToken = authUtil.defaultAdminLogin()
@ -77,27 +58,6 @@ class ScheduleApiTest(
} }
context("동일한 날짜, 테마에 대한 모든 시간을 조회한다.") { context("동일한 날짜, 테마에 대한 모든 시간을 조회한다.") {
context("권한이 없으면 접근할 수 없다.") {
val endpoint = "/schedules?date=2025-09-12&themeId=12345"
test("관리자") {
runExceptionTest(
token = authUtil.defaultAdminLogin(),
method = HttpMethod.GET,
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.ACCESS_DENIED
)
}
test("비회원") {
runExceptionTest(
method = HttpMethod.GET,
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.TOKEN_NOT_FOUND
)
}
}
test("정상 응답") { test("정상 응답") {
val date = LocalDate.now().plusDays(1) val date = LocalDate.now().plusDays(1)