From a4d28322fb348b4a94c447d0ddd70e94e71a7722 Mon Sep 17 00:00:00 2001 From: pricelees Date: Sat, 27 Sep 2025 15:19:42 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=9D=B8=EA=B8=B0=20=ED=85=8C?= =?UTF-8?q?=EB=A7=88=20=EC=A1=B0=ED=9A=8C=20API=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20reservation=EC=97=90=EC=84=9C?= =?UTF-8?q?=EC=9D=98=20API=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/ReservationService.kt | 17 ----------------- .../reservation/docs/ReservationAPI.kt | 8 -------- .../persistence/ReservationRepository.kt | 19 ------------------- .../reservation/web/ReservationController.kt | 10 ---------- 4 files changed, 54 deletions(-) diff --git a/src/main/kotlin/roomescape/reservation/business/ReservationService.kt b/src/main/kotlin/roomescape/reservation/business/ReservationService.kt index c9ee3a41..346ac043 100644 --- a/src/main/kotlin/roomescape/reservation/business/ReservationService.kt +++ b/src/main/kotlin/roomescape/reservation/business/ReservationService.kt @@ -121,23 +121,6 @@ class ReservationService( } } - @Transactional(readOnly = true) - fun findMostReservedThemeIds(count: Int): MostReservedThemeIdListResponse { - log.info { "[ReservationService.findMostReservedThemeIds] 인기 테마 조회 시작: count=$count" } - val previousWeekSunday = DateUtils.getSundayOfPreviousWeek(LocalDate.now()) - val previousWeekSaturday = previousWeekSunday.plusDays(6) - - val themeIds: List = reservationRepository.findMostReservedThemeIds( - dateFrom = previousWeekSunday, - dateTo = previousWeekSaturday, - count = count - ) - - return MostReservedThemeIdListResponse(themeIds = themeIds).also { - log.info { "[ReservationService.findMostReservedThemeIds] 인기 테마 조회 완료: count=${it.themeIds.size}" } - } - } - private fun findOrThrow(id: Long): ReservationEntity { log.info { "[ReservationService.findOrThrow] 예약 조회 시작: reservationId=${id}" } diff --git a/src/main/kotlin/roomescape/reservation/docs/ReservationAPI.kt b/src/main/kotlin/roomescape/reservation/docs/ReservationAPI.kt index bd32e862..7481e3e4 100644 --- a/src/main/kotlin/roomescape/reservation/docs/ReservationAPI.kt +++ b/src/main/kotlin/roomescape/reservation/docs/ReservationAPI.kt @@ -16,14 +16,6 @@ import roomescape.common.dto.response.CommonApiResponse import roomescape.reservation.web.* interface ReservationAPI { - - @Public - @Operation(summary = "가장 많이 예약된 테마 ID 조회") - @ApiResponses(ApiResponse(responseCode = "200", useReturnTypeSchema = true)) - fun findMostReservedThemeIds( - @RequestParam count: Int - ): ResponseEntity> - @Operation(summary = "결제 전 임시 예약 저장") @ApiResponses(ApiResponse(responseCode = "200", useReturnTypeSchema = true)) fun createPendingReservation( diff --git a/src/main/kotlin/roomescape/reservation/infrastructure/persistence/ReservationRepository.kt b/src/main/kotlin/roomescape/reservation/infrastructure/persistence/ReservationRepository.kt index 08bac9f6..af90de13 100644 --- a/src/main/kotlin/roomescape/reservation/infrastructure/persistence/ReservationRepository.kt +++ b/src/main/kotlin/roomescape/reservation/infrastructure/persistence/ReservationRepository.kt @@ -1,27 +1,8 @@ package roomescape.reservation.infrastructure.persistence import org.springframework.data.jpa.repository.JpaRepository -import org.springframework.data.jpa.repository.Query -import org.springframework.data.repository.query.Param -import java.time.LocalDate interface ReservationRepository : JpaRepository { fun findAllByUserIdAndStatusIsIn(userId: Long, statuses: List): List - - @Query(""" - SELECT s.themeId - FROM ReservationEntity r - JOIN ScheduleEntity s ON s._id = r.scheduleId - WHERE r.status = roomescape.reservation.infrastructure.persistence.ReservationStatus.CONFIRMED - AND s.date BETWEEN :dateFrom AND :dateTo - GROUP BY s.themeId - ORDER BY count(r) DESC - LIMIT :count - """) - fun findMostReservedThemeIds( - @Param("dateFrom") dateFrom: LocalDate, - @Param("dateTo") dateTo: LocalDate, - @Param("count") count: Int - ): List } diff --git a/src/main/kotlin/roomescape/reservation/web/ReservationController.kt b/src/main/kotlin/roomescape/reservation/web/ReservationController.kt index 68117ff9..15105419 100644 --- a/src/main/kotlin/roomescape/reservation/web/ReservationController.kt +++ b/src/main/kotlin/roomescape/reservation/web/ReservationController.kt @@ -14,16 +14,6 @@ import roomescape.reservation.docs.ReservationAPI class ReservationController( private val reservationService: ReservationService ) : ReservationAPI { - - @GetMapping("/popular-themes") - override fun findMostReservedThemeIds( - @RequestParam count: Int - ): ResponseEntity> { - val response = reservationService.findMostReservedThemeIds(count) - - return ResponseEntity.ok(CommonApiResponse(response)) - } - @PostMapping("/pending") override fun createPendingReservation( @User user: CurrentUserContext,