Skip to content

Commit

Permalink
add :: endpoint 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
ta2ye0n committed Apr 7, 2024
1 parent 761922e commit 77650fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@
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;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v2/order")
public class OrdersController {
private final BookRequestService bookRequestService;
private final DeleteBookOrderService deleteBookOrderService;
private final UpdateBookOrderService updateBookOrderService;
private final GetBookOrdersService getBookOrdersService;

@PostMapping()
public ResponseEntity<Void> bookRequest
Expand All @@ -40,4 +45,10 @@ public ResponseEntity<Void> deleteBook (@PathVariable(value = "order_id") Long i
return ResponseEntity.noContent().build();
}

@GetMapping
public ResponseEntity<List<OrdersResponse>> bookOrders () {
List<OrdersResponse> orders = getBookOrdersService.execute();
return ResponseEntity.ok(orders);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
Expand Down

0 comments on commit 77650fa

Please sign in to comment.