Class OrderController
- java.lang.Object
-
- edu.cnm.deepdive.albuquirky.controller.OrderController
-
@RestController @RequestMapping("/orders") @ExposesResourceFor(Order.class) public class OrderController extends ObjectThe OrderController class is the @RestController that maps the endpoints of "/orders" for communication between the server-side and client-side forOrder.
-
-
Constructor Summary
Constructors Constructor Description OrderController(OrderService orderService)Constructs the instance of OrderService object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OrdergetOrder(long orderId)The Get method which returns an order by the order ID.List<Order>getUserOrders(org.springframework.security.core.Authentication auth)The Get method which returns a list of the user's placed orders.List<Order>getUserSoldOrders(org.springframework.security.core.Authentication auth)The Get method which returns a list of the orders the user is responsible for fulfilling.Orderpost(Order order, Product product, org.springframework.security.core.Authentication auth)The Post method for creating an order.
-
-
-
Constructor Detail
-
OrderController
public OrderController(OrderService orderService)
Constructs the instance of OrderService object.- Parameters:
orderService- The instance ofOrderServiceto initialize.
-
-
Method Detail
-
getUserOrders
@GetMapping(value="/user-orders", produces="application/json") public List<Order> getUserOrders(org.springframework.security.core.Authentication auth)The Get method which returns a list of the user's placed orders.- Parameters:
auth- The user authentication.- Returns:
- A
ListofOrderobjects representing the user's placed orders.
-
getUserSoldOrders
@GetMapping(value="/user-sold-orders", produces="application/json") public List<Order> getUserSoldOrders(org.springframework.security.core.Authentication auth)The Get method which returns a list of the orders the user is responsible for fulfilling.- Parameters:
auth- The user authentication.- Returns:
- A
ListofOrderobjects representing the orders the user is responsible for fulfilling.
-
getOrder
@GetMapping(value="/{orderId:\\d+}", produces="application/json") public Order getOrder(@PathVariable long orderId)The Get method which returns an order by the order ID.
-
-