From 77650faed8035d8532e3d889e5d14c6a899176b5 Mon Sep 17 00:00:00 2001 From: taeyeon Date: Sun, 7 Apr 2024 14:59:03 +0900 Subject: [PATCH] =?UTF-8?q?add=20::=20endpoint=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/order/presentation/OrdersController.java | 11 +++++++++++ .../v2/global/security/config/SecurityConfig.java | 1 + 2 files changed, 12 insertions(+) diff --git a/src/main/java/com/mindway/server/v2/domain/order/presentation/OrdersController.java b/src/main/java/com/mindway/server/v2/domain/order/presentation/OrdersController.java index d02abf4..74aad69 100644 --- a/src/main/java/com/mindway/server/v2/domain/order/presentation/OrdersController.java +++ b/src/main/java/com/mindway/server/v2/domain/order/presentation/OrdersController.java @@ -3,8 +3,10 @@ import com.mindway.server.v2.domain.order.entity.BookType; import com.mindway.server.v2.domain.order.presentation.dto.request.OrderRequest; import com.mindway.server.v2.domain.order.presentation.dto.request.OrderUpdateRequest; +import com.mindway.server.v2.domain.order.presentation.dto.response.OrdersResponse; import com.mindway.server.v2.domain.order.service.BookRequestService; import com.mindway.server.v2.domain.order.service.DeleteBookOrderService; +import com.mindway.server.v2.domain.order.service.GetBookOrdersService; import com.mindway.server.v2.domain.order.service.UpdateBookOrderService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -12,6 +14,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequiredArgsConstructor @RequestMapping("/api/v2/order") @@ -19,6 +23,7 @@ public class OrdersController { private final BookRequestService bookRequestService; private final DeleteBookOrderService deleteBookOrderService; private final UpdateBookOrderService updateBookOrderService; + private final GetBookOrdersService getBookOrdersService; @PostMapping() public ResponseEntity bookRequest @@ -40,4 +45,10 @@ public ResponseEntity deleteBook (@PathVariable(value = "order_id") Long i return ResponseEntity.noContent().build(); } + @GetMapping + public ResponseEntity> bookOrders () { + List orders = getBookOrdersService.execute(); + return ResponseEntity.ok(orders); + } + } diff --git a/src/main/java/com/mindway/server/v2/global/security/config/SecurityConfig.java b/src/main/java/com/mindway/server/v2/global/security/config/SecurityConfig.java index 56d1801..8edc725 100644 --- a/src/main/java/com/mindway/server/v2/global/security/config/SecurityConfig.java +++ b/src/main/java/com/mindway/server/v2/global/security/config/SecurityConfig.java @@ -57,6 +57,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .requestMatchers(HttpMethod.POST, "/api/v2/order").authenticated() .requestMatchers(HttpMethod.DELETE, "/api/v2/order/{order_id}").authenticated() .requestMatchers(HttpMethod.PATCH, "api/v2/order/{order_id}").authenticated() + .requestMatchers(HttpMethod.GET, "api/v2/order").authenticated() .anyRequest().authenticated() )