From 15849ee769154a14ca9df0142e68d2da0327c4fd Mon Sep 17 00:00:00 2001 From: le2sky Date: Wed, 20 Sep 2023 02:19:37 +0900 Subject: [PATCH 1/7] =?UTF-8?q?feat=20:=20=EA=B0=80=EA=B2=8C=20=EC=8B=9D?= =?UTF-8?q?=EB=B3=84=EC=9E=90=EB=A1=9C=20=EC=98=88=EC=95=BD=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=BF=BC=EB=A6=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/ReservationRepository.kt | 2 ++ ...ingDataJpaReservationPersistenceAdapter.kt | 13 +++++-- ...ataJpaReservationPersistenceAdapterTest.kt | 35 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/ReservationRepository.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/ReservationRepository.kt index 53c76f5..136f4d8 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/ReservationRepository.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/ReservationRepository.kt @@ -10,4 +10,6 @@ interface ReservationRepository : JpaRepository { @EntityGraph(attributePaths = ["shop"]) fun findOneWithShopById(reservationId: UUID): Optional + + fun findAllByShopId(shopId: Long): List } diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapter.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapter.kt index 1d8ffb1..009fad5 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapter.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/main/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapter.kt @@ -47,7 +47,17 @@ class SpringDataJpaReservationPersistenceAdapter( val reservation = reservationRepository.findOneWithShopById(reservationId) .orElseThrow { throw EntityNotFoundException(NOT_FOUND_RESERVATION_MESSAGE) } - return ReservationResponse( + return mapToReservationResponse(reservation) + } + + override fun queryAllReservationByShopId(shopId: Long): List { + val reservations = reservationRepository.findAllByShopId(shopId) + + return reservations.map { mapToReservationResponse(it) } + } + + private fun mapToReservationResponse(reservation: Reservation) = + ReservationResponse( reservation.id, reservation.shop.title, reservation.buildDescription(), @@ -62,5 +72,4 @@ class SpringDataJpaReservationPersistenceAdapter( ) } ) - } } diff --git a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt index 17b0243..f674e75 100644 --- a/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt +++ b/mealkitary-infrastructure/adapter-persistence-spring-data-jpa/src/test/kotlin/com/mealkitary/reservation/persistence/SpringDataJpaReservationPersistenceAdapterTest.kt @@ -9,6 +9,7 @@ import com.mealkitary.reservation.domain.reservation.ReservationStatus import com.mealkitary.shop.persistence.ShopRepository import data.ReservationTestData import io.kotest.assertions.throwables.shouldThrow +import io.kotest.inspectors.forAll import io.kotest.matchers.booleans.shouldBeTrue import io.kotest.matchers.shouldBe import io.kotest.matchers.throwable.shouldHaveMessage @@ -91,6 +92,40 @@ class SpringDataJpaReservationPersistenceAdapterTest( result.description shouldBe "부대찌개 외 1건" } + @Test + fun `db integration test - 가게 식별자로 예약의 상세 정보 목록을 조회한다`() { + val reservation = ReservationTestData.defaultReservation() + .withReservationStatus(ReservationStatus.NOTPAID) + .withShop(shopRepository.findOneWithProductsById(1L).orElseThrow()) + .build() + val saved = adapterUnderTest.saveOne(reservation) + em.flush() + em.clear() + + val result = adapterUnderTest.queryAllReservationByShopId(1L) + + val resultReservation = result.get(0) + result.size shouldBe 1 + resultReservation.reservationId shouldBe saved + resultReservation.status shouldBe "NOTPAID" + resultReservation.shopName shouldBe "집밥뚝딱 철산점" + resultReservation.reservedProduct.size shouldBe 2 + resultReservation.description shouldBe "부대찌개 외 1건" + } + + @Test + fun `db integration test - 가게 식별자로 예약의 상세 목록을 조회할 때, 관련 데이터가 없으면 빈 리스트를 반환한다`() { + val unknownShopId = 12345L + val noReservationShopId = 1L + val source = listOf(unknownShopId, noReservationShopId) + + source.forAll { + val result = adapterUnderTest.queryAllReservationByShopId(it) + + result.isEmpty().shouldBeTrue() + } + } + @Test fun `db integration test - 결제를 조회한다`() { val reservation = ReservationTestData.defaultReservation() From debd0fe9db28aef9d66279b7b32c65b25a2bcb2b Mon Sep 17 00:00:00 2001 From: le2sky Date: Wed, 20 Sep 2023 02:23:07 +0900 Subject: [PATCH 2/7] =?UTF-8?q?feat=20:=20=EA=B0=80=EA=B2=8C=20=EC=8B=9D?= =?UTF-8?q?=EB=B3=84=EC=9E=90=20=EA=B8=B0=EB=B0=98=20=EC=98=88=EC=95=BD=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../port/input/GetReservationQuery.kt | 2 ++ .../port/output/LoadReservationPort.kt | 2 ++ .../service/GetReservationService.kt | 4 +++ .../service/GetReservationServiceTest.kt | 33 +++++++++++++++++++ 4 files changed, 41 insertions(+) diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/input/GetReservationQuery.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/input/GetReservationQuery.kt index 12bd50a..57c3884 100644 --- a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/input/GetReservationQuery.kt +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/input/GetReservationQuery.kt @@ -5,4 +5,6 @@ import java.util.UUID interface GetReservationQuery { fun loadOneReservationById(reservationId: UUID): ReservationResponse + + fun loadAllReservationByShopId(shopId: Long): List } diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/LoadReservationPort.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/LoadReservationPort.kt index 61eb16c..84b3993 100644 --- a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/LoadReservationPort.kt +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/port/output/LoadReservationPort.kt @@ -9,4 +9,6 @@ interface LoadReservationPort { fun loadOneReservationById(reservationId: UUID): Reservation fun queryOneReservationById(reservationId: UUID): ReservationResponse + + fun queryAllReservationByShopId(shopId: Long): List } diff --git a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/GetReservationService.kt b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/GetReservationService.kt index 5e39ba3..84f19d0 100644 --- a/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/GetReservationService.kt +++ b/mealkitary-application/src/main/kotlin/com/mealkitary/reservation/application/service/GetReservationService.kt @@ -1,6 +1,7 @@ package com.mealkitary.reservation.application.service import com.mealkitary.reservation.application.port.input.GetReservationQuery +import com.mealkitary.reservation.application.port.input.ReservationResponse import com.mealkitary.reservation.application.port.output.LoadReservationPort import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -14,4 +15,7 @@ class GetReservationService( override fun loadOneReservationById(reservationId: UUID) = loadReservationPort.queryOneReservationById(reservationId) + + override fun loadAllReservationByShopId(shopId: Long): List = + loadReservationPort.queryAllReservationByShopId(shopId) } diff --git a/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/GetReservationServiceTest.kt b/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/GetReservationServiceTest.kt index 8fbf2c5..b39c5eb 100644 --- a/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/GetReservationServiceTest.kt +++ b/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/GetReservationServiceTest.kt @@ -36,4 +36,37 @@ class GetReservationServiceTest : AnnotationSpec() { result.status shouldBe "PAID" result.reservedProduct.isEmpty().shouldBeTrue() } + + @Test + fun `service unit test - 가게 식별자로 예약의 상세 정보 목록을 조회한다`() { + val reservationId = UUID.randomUUID() + every { loadReservationPort.queryAllReservationByShopId(any()) } answers { + listOf( + ReservationResponse( + reservationId, + "집밥뚝딱 안양점", + "부대찌개 외 1건", + LocalDateTime.now(), + "PAID", + emptyList() + ), ReservationResponse( + reservationId, + "집밥뚝딱 안양점", + "부대찌개 외 1건", + LocalDateTime.now(), + "PAID", + emptyList() + ) + ) + } + + val result = getReservationService.loadAllReservationByShopId(1L) + + val resultReservation = result.get(0) + result.size shouldBe 2 + resultReservation.reservationId shouldBe reservationId + resultReservation.shopName shouldBe "집밥뚝딱 안양점" + resultReservation.status shouldBe "PAID" + resultReservation.reservedProduct.isEmpty().shouldBeTrue() + } } From 16f68882bb076222490fd249883f745ca7e0d5bb Mon Sep 17 00:00:00 2001 From: le2sky Date: Wed, 20 Sep 2023 02:54:31 +0900 Subject: [PATCH 3/7] =?UTF-8?q?style=20:=20=EC=98=88=EC=95=BD=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=ED=8F=AC=EB=A7=A4=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/GetReservationServiceTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/GetReservationServiceTest.kt b/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/GetReservationServiceTest.kt index b39c5eb..080e552 100644 --- a/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/GetReservationServiceTest.kt +++ b/mealkitary-application/src/test/kotlin/com/mealkitary/reservation/application/service/GetReservationServiceTest.kt @@ -49,7 +49,8 @@ class GetReservationServiceTest : AnnotationSpec() { LocalDateTime.now(), "PAID", emptyList() - ), ReservationResponse( + ), + ReservationResponse( reservationId, "집밥뚝딱 안양점", "부대찌개 외 1건", From 0e566c21908fb47e56a88e80f196c2269a43a9f7 Mon Sep 17 00:00:00 2001 From: le2sky Date: Wed, 20 Sep 2023 02:54:48 +0900 Subject: [PATCH 4/7] =?UTF-8?q?feat=20:=20=EA=B0=80=EA=B2=8C=20=EC=8B=9D?= =?UTF-8?q?=EB=B3=84=EC=9E=90=20=EA=B8=B0=EB=B0=98=20=EC=98=88=EC=95=BD=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/GetReservationController.kt | 12 +++ .../web/GetReservationControllerTest.kt | 78 ++++++++++++++++++- 2 files changed, 87 insertions(+), 3 deletions(-) diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt index d427904..275ead9 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt @@ -1,10 +1,14 @@ package com.mealkitary.reservation.web +import com.mealkitary.common.utils.HttpResponseUtils import com.mealkitary.common.utils.UUIDUtils import com.mealkitary.reservation.application.port.input.GetReservationQuery +import com.mealkitary.reservation.application.port.input.ReservationResponse +import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController @RestController @@ -16,4 +20,12 @@ class GetReservationController( @GetMapping("/{reservationId}") fun getOneReservation(@PathVariable("reservationId") reservationId: String) = getReservationQuery.loadOneReservationById(UUIDUtils.fromString(reservationId)) + + @GetMapping + fun getAllReservation(@RequestParam("shopId") shopIdParam: Long?): ResponseEntity> { + val shopId = shopIdParam ?: throw IllegalArgumentException("가게 식별자는 필수입니다.") + + return HttpResponseUtils + .mapToResponseEntity(emptiableList = getReservationQuery.loadAllReservationByShopId(shopId)) + } } diff --git a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/GetReservationControllerTest.kt b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/GetReservationControllerTest.kt index 6251ea9..07a4182 100644 --- a/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/GetReservationControllerTest.kt +++ b/mealkitary-api/src/test/kotlin/com/mealkitary/reservation/web/GetReservationControllerTest.kt @@ -4,6 +4,7 @@ import com.mealkitary.WebIntegrationTestSupport import com.mealkitary.common.exception.EntityNotFoundException import com.mealkitary.reservation.application.port.input.ReservationResponse import com.mealkitary.reservation.application.port.input.ReservedProduct +import io.kotest.inspectors.forAll import io.mockk.every import org.springframework.http.MediaType import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get @@ -66,17 +67,88 @@ class GetReservationControllerTest : WebIntegrationTestSupport() { } @Test - fun `api integration test - 예약 식별자가 UUID 형태가 아니라면 400 에러를 발생한다`() { + fun `api integration test - getAllReservation`() { + val reservationId = UUID.randomUUID() + val reserveAt = LocalDateTime.of( + LocalDate.of(2023, 6, 23), LocalTime.of(6, 30) + ) + every { getReservationQuery.loadAllReservationByShopId(1L) } answers { + listOf( + ReservationResponse( + reservationId, + "집밥뚝딱 안양점", + "부대찌개 외 1건", + reserveAt, + "PAID", + listOf( + ReservedProduct( + 1L, + "부대찌개", + 20000, + 2 + ), + ReservedProduct( + 2L, + "김치찌개", + 20000, + 1 + ) + ) + ) + ) + } + + mvc.perform(get("/reservations?shopId=1")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$.[0].reservationId").value(reservationId.toString())) + .andExpect(jsonPath("$.[0].shopName").value("집밥뚝딱 안양점")) + .andExpect(jsonPath("$.[0].reserveAt").value(reserveAt.format(DateTimeFormatter.ISO_DATE_TIME))) + .andExpect(jsonPath("$.[0].status").value("PAID")) + .andExpect(jsonPath("$.[0].reservedProduct[0].productId").value(1L)) + .andExpect(jsonPath("$.[0].reservedProduct[0].name").value("부대찌개")) + .andExpect(jsonPath("$.[0].reservedProduct[0].price").value(20000)) + .andExpect(jsonPath("$.[0].reservedProduct[0].count").value(2)) + .andExpect(jsonPath("$.[0].reservedProduct[1].productId").value(2L)) + .andExpect(jsonPath("$.[0].reservedProduct[1].name").value("김치찌개")) + .andExpect(jsonPath("$.[0].reservedProduct[1].price").value(20000)) + .andExpect(jsonPath("$.[0].reservedProduct[1].count").value(1)) + } + + @Test + fun `api integration test - getAllReservation - 쿼리 파라미터에 가게 식별자가 누락된 경우 400 에러를 발생한다`() { + every { getReservationQuery.loadAllReservationByShopId(any()) } answers { emptyList() } + + listOf("/reservations?shopId=", "/reservations", "/reservations?shopId") + .forAll { + mvc.perform(get(it)) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$.status").value(400)) + .andExpect(jsonPath("$.message").value("가게 식별자는 필수입니다.")) + } + } + + @Test + fun `api integration test - getAllReservation - 해당 가게의 예약이 존재하지 않으면 204 NoContent를 반환한다`() { + every { getReservationQuery.loadAllReservationByShopId(any()) } answers { emptyList() } + + mvc.perform(get("/reservations?shopId=1")) + .andExpect(status().isNoContent()) + } + + @Test + fun `api integration test - getOneReservation - 예약 식별자가 UUID 형태가 아니라면 400 에러를 발생한다`() { mvc.perform( get("/reservations/{reservationId}", "invalid-uuid-test") ) - .andExpect(status().isBadRequest) + .andExpect(status().isBadRequest()) .andExpect(jsonPath("$.status").value("400")) .andExpect(jsonPath("$.message").value("잘못된 UUID 형식입니다.")) } @Test - fun `api integration test - 내부에서 EntityNotFound 에러가 발생하면 404 에러를 발생한다`() { + fun `api integration test - getOneReservation - 내부에서 EntityNotFound 에러가 발생하면 404 에러를 발생한다`() { every { getReservationQuery.loadOneReservationById(any()) } .throws(EntityNotFoundException("존재하지 않는 예약입니다.")) From 5704c727d656b6b1c73a974915a4ef2b15956391 Mon Sep 17 00:00:00 2001 From: le2sky Date: Wed, 20 Sep 2023 03:01:46 +0900 Subject: [PATCH 5/7] =?UTF-8?q?test=20:=20=EA=B0=80=EA=B2=8C=20=EC=8B=9D?= =?UTF-8?q?=EB=B3=84=EC=9E=90=20=EA=B8=B0=EB=B0=98=20=EC=98=88=EC=95=BD=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EB=AC=B8=EC=84=9C=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetReservationControllerDocsTest.kt | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt b/mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt index c1ed274..7e0d2f2 100644 --- a/mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt +++ b/mealkitary-api/src/test/kotlin/com/docs/reservation/GetReservationControllerDocsTest.kt @@ -18,9 +18,12 @@ import org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath import org.springframework.restdocs.payload.PayloadDocumentation.responseFields import org.springframework.restdocs.request.RequestDocumentation.parameterWithName import org.springframework.restdocs.request.RequestDocumentation.pathParameters +import org.springframework.restdocs.request.RequestDocumentation.requestParameters import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status +import java.time.LocalDate import java.time.LocalDateTime +import java.time.LocalTime import java.util.UUID class GetReservationControllerDocsTest : RestDocsSupport() { @@ -84,5 +87,67 @@ class GetReservationControllerDocsTest : RestDocsSupport() { ) } + @Test + fun `api integration test - getAllReservation`() { + val reservationId = UUID.randomUUID() + val reserveAt = LocalDateTime.of( + LocalDate.of(2023, 6, 23), LocalTime.of(6, 30) + ) + every { getReservationQuery.loadAllReservationByShopId(1L) } answers { + listOf( + ReservationResponse( + reservationId, + "집밥뚝딱 안양점", + "부대찌개 외 1건", + reserveAt, + "PAID", + listOf( + ReservedProduct( + 1L, + "부대찌개", + 20000, + 2 + ), + ReservedProduct( + 2L, + "김치찌개", + 20000, + 1 + ) + ) + ) + ) + } + + mvc.perform(RestDocumentationRequestBuilders.get("/reservations?shopId=1")) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) + .andDo( + document( + "reservation-get-all", + preprocessRequest(prettyPrint()), + preprocessResponse(prettyPrint()), + requestParameters( + parameterWithName("shopId").description("예약 조회 대상 가게 식별자") + ), + responseFields( + fieldWithPath("[].reservationId").type(JsonFieldType.STRING).description("예약 식별자"), + fieldWithPath("[].shopName").type(JsonFieldType.STRING).description("예약 대상 가게의 이름"), + fieldWithPath("[].description").type(JsonFieldType.STRING).description("예약 개요"), + fieldWithPath("[].reserveAt").type(JsonFieldType.STRING) + .description("예약 시간(yyyy-mm-ddThh:mm:ss)"), + fieldWithPath("[].status").type(JsonFieldType.STRING).description("예약 상태"), + fieldWithPath("[].reservedProduct.[].productId").type(JsonFieldType.NUMBER) + .description("예약 상품 식별자"), + fieldWithPath("[].reservedProduct.[].name").type(JsonFieldType.STRING) + .description("예약 상품명"), + fieldWithPath("[].reservedProduct.[].price").type(JsonFieldType.NUMBER) + .description("예약 상품 가격"), + fieldWithPath("[].reservedProduct.[].count").type(JsonFieldType.NUMBER).description("예약 수량") + ) + ) + ) + } + override fun initController() = GetReservationController(getReservationQuery) } From 75be90ff9891715d40e51dc4e487bcf018696858 Mon Sep 17 00:00:00 2001 From: le2sky Date: Wed, 20 Sep 2023 03:05:11 +0900 Subject: [PATCH 6/7] =?UTF-8?q?docs=20:=20=EA=B0=80=EA=B2=8C=20=EC=8B=9D?= =?UTF-8?q?=EB=B3=84=EC=9E=90=20=EA=B8=B0=EB=B0=98=20=EC=98=88=EC=95=BD=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mealkitary-api/src/docs/asciidoc/reservation.adoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mealkitary-api/src/docs/asciidoc/reservation.adoc b/mealkitary-api/src/docs/asciidoc/reservation.adoc index c371a20..d2d6da7 100644 --- a/mealkitary-api/src/docs/asciidoc/reservation.adoc +++ b/mealkitary-api/src/docs/asciidoc/reservation.adoc @@ -40,6 +40,20 @@ include::{snippets}/reservation-get/path-parameters.adoc[] include::{snippets}/reservation-get/http-response.adoc[] +==== 대상 가게 예약 목록 조회 + +가게 식별자를 기반으로 예약 목록을 조회합니다. + +===== 요청 + +include::{snippets}/reservation-get-all/curl-request.adoc[] +include::{snippets}/reservation-get-all/http-request.adoc[] +include::{snippets}/reservation-get-all/request-parameters.adoc[] + +===== 응답 + +include::{snippets}/reservation-get-all/http-response.adoc[] + ==== 예약 결제 미결제 상태의 예약에 대해 결제를 생성/승인합니다. From 2bc1a00a95ec785e069e3ca7268ce99b1c5c9e81 Mon Sep 17 00:00:00 2001 From: le2sky Date: Wed, 20 Sep 2023 21:27:55 +0900 Subject: [PATCH 7/7] =?UTF-8?q?refactor=20:=20requireNotNull=EB=A1=9C=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mealkitary/reservation/web/GetReservationController.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt index 275ead9..2fb5d2d 100644 --- a/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt +++ b/mealkitary-api/src/main/kotlin/com/mealkitary/reservation/web/GetReservationController.kt @@ -23,7 +23,7 @@ class GetReservationController( @GetMapping fun getAllReservation(@RequestParam("shopId") shopIdParam: Long?): ResponseEntity> { - val shopId = shopIdParam ?: throw IllegalArgumentException("가게 식별자는 필수입니다.") + val shopId = requireNotNull(shopIdParam) { "가게 식별자는 필수입니다." } return HttpResponseUtils .mapToResponseEntity(emptiableList = getReservationQuery.loadAllReservationByShopId(shopId))