rename: 테마 DTO 이름 변경 및 컨벤션 통일

This commit is contained in:
이상진 2025-09-13 13:57:20 +09:00
parent 16ee7eecf3
commit bf6b1b5cdc
7 changed files with 28 additions and 28 deletions

View File

@ -22,7 +22,7 @@ import roomescape.schedule.infrastructure.persistence.ScheduleStatus
import roomescape.schedule.web.ScheduleSummaryResponse
import roomescape.schedule.web.ScheduleUpdateRequest
import roomescape.theme.business.ThemeService
import roomescape.theme.web.ThemeSummaryResponse
import roomescape.theme.web.ThemeInfoRetrieveResponse
import java.time.LocalDateTime
private val log: KLogger = KotlinLogging.logger {}
@ -96,7 +96,7 @@ class ReservationService(
return ReservationSummaryRetrieveListResponse(reservations.map {
val schedule: ScheduleSummaryResponse = scheduleService.findSummaryById(it.scheduleId)
val theme: ThemeSummaryResponse = themeService.findSummaryById(schedule.themeId)
val theme: ThemeInfoRetrieveResponse = themeService.findSummaryById(schedule.themeId)
ReservationSummaryRetrieveResponse(
id = it.id,

View File

@ -8,7 +8,7 @@ import roomescape.reservation.exception.ReservationException
import roomescape.reservation.web.PendingReservationCreateRequest
import roomescape.schedule.infrastructure.persistence.ScheduleStatus
import roomescape.schedule.web.ScheduleSummaryResponse
import roomescape.theme.web.ThemeSummaryResponse
import roomescape.theme.web.ThemeInfoRetrieveResponse
private val log: KLogger = KotlinLogging.logger {}
@ -17,7 +17,7 @@ class ReservationValidator {
fun validateCanCreate(
schedule: ScheduleSummaryResponse,
theme: ThemeSummaryResponse,
theme: ThemeInfoRetrieveResponse,
request: PendingReservationCreateRequest
) {
if (schedule.status != ScheduleStatus.HOLD) {

View File

@ -24,7 +24,7 @@ class ThemeService(
private val adminService: AdminService
) {
@Transactional(readOnly = true)
fun findThemesByIds(request: ThemeListRetrieveRequest): ThemeSummaryListResponse {
fun findThemesByIds(request: ThemeIdListRetrieveResponse): ThemeInfoListRetrieveResponse {
log.info { "[ThemeService.findThemesByIds] 예약 페이지에서의 테마 목록 조회 시작: themeIds=${request.themeIds}" }
val result: MutableList<ThemeEntity> = mutableListOf()
@ -43,7 +43,7 @@ class ThemeService(
}
@Transactional(readOnly = true)
fun findThemesForReservation(): ThemeSummaryListResponse {
fun findThemesForReservation(): ThemeInfoListRetrieveResponse {
log.info { "[ThemeService.findThemesForReservation] 예약 페이지에서의 테마 목록 조회 시작" }
return themeRepository.findOpenedThemes()
@ -52,7 +52,7 @@ class ThemeService(
}
@Transactional(readOnly = true)
fun findAdminThemes(): AdminThemeSummaryRetrieveListResponse {
fun findAdminThemes(): AdminThemeSummaryListRetrieveResponse {
log.info { "[ThemeService.findAdminThemes] 관리자 페이지에서의 테마 목록 조회 시작" }
return themeRepository.findAll()
@ -74,7 +74,7 @@ class ThemeService(
}
@Transactional(readOnly = true)
fun findSummaryById(id: Long): ThemeSummaryResponse {
fun findSummaryById(id: Long): ThemeInfoRetrieveResponse {
log.info { "[ThemeService.findById] 테마 조회 시작: id=$id" }
return findOrThrow(id).toSummaryResponse()

View File

@ -20,7 +20,7 @@ interface ThemeAPIV2 {
@AdminOnly(privilege = Privilege.READ_SUMMARY)
@Operation(summary = "모든 테마 조회", description = "관리자 페이지에서 요약된 테마 목록을 조회합니다.", tags = ["관리자 로그인이 필요한 API"])
@ApiResponses(ApiResponse(responseCode = "200", description = "성공", useReturnTypeSchema = true))
fun findAdminThemes(): ResponseEntity<CommonApiResponse<AdminThemeSummaryRetrieveListResponse>>
fun findAdminThemes(): ResponseEntity<CommonApiResponse<AdminThemeSummaryListRetrieveResponse>>
@AdminOnly(privilege = Privilege.READ_DETAIL)
@Operation(summary = "테마 상세 조회", description = "해당 테마의 상세 정보를 조회합니다.", tags = ["관리자 로그인이 필요한 API"])
@ -48,10 +48,10 @@ interface ThemeAPIV2 {
@UserOnly
@Operation(summary = "예약 페이지에서 모든 테마 조회", description = "모든 테마를 조회합니다.", tags = ["로그인이 필요한 API"])
@ApiResponses(ApiResponse(responseCode = "200", description = "성공", useReturnTypeSchema = true))
fun findUserThemes(): ResponseEntity<CommonApiResponse<ThemeSummaryListResponse>>
fun findUserThemes(): ResponseEntity<CommonApiResponse<ThemeInfoListRetrieveResponse>>
@UserOnly
@Operation(summary = "예약 페이지에서 입력한 날짜에 가능한 테마 조회", description = "입력한 날짜에 가능한 테마를 조회합니다.", tags = ["로그인이 필요한 API"])
@ApiResponses(ApiResponse(responseCode = "200", description = "성공", useReturnTypeSchema = true))
fun findThemesByIds(request: ThemeListRetrieveRequest): ResponseEntity<CommonApiResponse<ThemeSummaryListResponse>>
fun findThemesByIds(request: ThemeIdListRetrieveResponse): ResponseEntity<CommonApiResponse<ThemeInfoListRetrieveResponse>>
}

View File

@ -14,22 +14,22 @@ class ThemeController(
@PostMapping("/themes/retrieve")
override fun findThemesByIds(
@RequestBody request: ThemeListRetrieveRequest
): ResponseEntity<CommonApiResponse<ThemeSummaryListResponse>> {
@RequestBody request: ThemeIdListRetrieveResponse
): ResponseEntity<CommonApiResponse<ThemeInfoListRetrieveResponse>> {
val response = themeService.findThemesByIds(request)
return ResponseEntity.ok(CommonApiResponse(response))
}
@GetMapping("/v2/themes")
override fun findUserThemes(): ResponseEntity<CommonApiResponse<ThemeSummaryListResponse>> {
override fun findUserThemes(): ResponseEntity<CommonApiResponse<ThemeInfoListRetrieveResponse>> {
val response = themeService.findThemesForReservation()
return ResponseEntity.ok(CommonApiResponse(response))
}
@GetMapping("/admin/themes")
override fun findAdminThemes(): ResponseEntity<CommonApiResponse<AdminThemeSummaryRetrieveListResponse>> {
override fun findAdminThemes(): ResponseEntity<CommonApiResponse<AdminThemeSummaryListRetrieveResponse>> {
val response = themeService.findAdminThemes()
return ResponseEntity.ok(CommonApiResponse(response))

View File

@ -82,11 +82,11 @@ fun ThemeEntity.toAdminThemeSummaryResponse() = AdminThemeSummaryRetrieveRespons
isOpen = this.isOpen
)
data class AdminThemeSummaryRetrieveListResponse(
data class AdminThemeSummaryListRetrieveResponse(
val themes: List<AdminThemeSummaryRetrieveResponse>
)
fun List<ThemeEntity>.toAdminThemeSummaryListResponse() = AdminThemeSummaryRetrieveListResponse(
fun List<ThemeEntity>.toAdminThemeSummaryListResponse() = AdminThemeSummaryListRetrieveResponse(
themes = this.map { it.toAdminThemeSummaryResponse() }
)
@ -129,11 +129,11 @@ fun ThemeEntity.toAdminThemeDetailResponse(createdBy: OperatorInfo, updatedBy: O
updatedBy = updatedBy
)
data class ThemeListRetrieveRequest(
data class ThemeIdListRetrieveResponse(
val themeIds: List<Long>
)
data class ThemeSummaryResponse(
data class ThemeInfoRetrieveResponse(
val id: Long,
val name: String,
val thumbnailUrl: String,
@ -147,7 +147,7 @@ data class ThemeSummaryResponse(
val expectedMinutesTo: Short
)
fun ThemeEntity.toSummaryResponse() = ThemeSummaryResponse(
fun ThemeEntity.toSummaryResponse() = ThemeInfoRetrieveResponse(
id = this.id,
name = this.name,
thumbnailUrl = this.thumbnailUrl,
@ -161,10 +161,10 @@ fun ThemeEntity.toSummaryResponse() = ThemeSummaryResponse(
expectedMinutesTo = this.expectedMinutesTo
)
data class ThemeSummaryListResponse(
val themes: List<ThemeSummaryResponse>
data class ThemeInfoListRetrieveResponse(
val themes: List<ThemeInfoRetrieveResponse>
)
fun List<ThemeEntity>.toRetrieveListResponse() = ThemeSummaryListResponse(
fun List<ThemeEntity>.toRetrieveListResponse() = ThemeInfoListRetrieveResponse(
themes = this.map { it.toSummaryResponse() }
)

View File

@ -18,7 +18,7 @@ import roomescape.theme.business.MIN_PRICE
import roomescape.theme.exception.ThemeErrorCode
import roomescape.theme.infrastructure.persistence.ThemeEntity
import roomescape.theme.infrastructure.persistence.ThemeRepository
import roomescape.theme.web.ThemeListRetrieveRequest
import roomescape.theme.web.ThemeIdListRetrieveResponse
import roomescape.theme.web.ThemeUpdateRequest
import roomescape.supports.*
import roomescape.supports.ThemeFixture.createRequest
@ -289,7 +289,7 @@ class ThemeApiTest(
test("비회원") {
runExceptionTest(
method = HttpMethod.POST,
requestBody = ThemeListRetrieveRequest(themeIds = listOf()),
requestBody = ThemeIdListRetrieveResponse(themeIds = listOf()),
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.TOKEN_NOT_FOUND
)
@ -299,7 +299,7 @@ class ThemeApiTest(
runExceptionTest(
token = authUtil.defaultAdminLogin(),
method = HttpMethod.POST,
requestBody = ThemeListRetrieveRequest(themeIds = listOf()),
requestBody = ThemeIdListRetrieveResponse(themeIds = listOf()),
endpoint = endpoint,
expectedErrorCode = AuthErrorCode.ACCESS_DENIED
)
@ -319,7 +319,7 @@ class ThemeApiTest(
runTest(
token = authUtil.defaultUserLogin(),
using = {
body(ThemeListRetrieveRequest(themeIds))
body(ThemeIdListRetrieveResponse(themeIds))
},
on = {
post("/themes/retrieve")
@ -345,7 +345,7 @@ class ThemeApiTest(
runTest(
token = authUtil.defaultUserLogin(),
using = {
body(ThemeListRetrieveRequest(themeIds))
body(ThemeIdListRetrieveResponse(themeIds))
},
on = {
post("/themes/retrieve")