Package com.myfood.controllers
Class ListOrderController
java.lang.Object
com.myfood.controllers.ListOrderController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?>deleteListOrder(Long id) Deletes an existing list order based on the provided list order ID.org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<com.myfood.dto.ListOrder>>getAllListOrders(int page, int size) Retrieves a list of all list orders with user information excluding passwords.org.springframework.http.ResponseEntity<?>getOneListOrder(Long id) Retrieves details of a specific list order identified by its ID.org.springframework.http.ResponseEntity<?>getOrdersByOrderId(Long orderId, int page, int size) Retrieves a paginated list of list orders associated with a specific order ID.org.springframework.http.ResponseEntity<com.myfood.dto.ListOrder>saveListOrder(com.myfood.dto.ListOrder entity) Creates a new list order based on the provided details.org.springframework.http.ResponseEntity<?>saveListOrder(Long orderid, Long itemid, String itemType) Creates a new list order based on the provided order ID, item ID, and item type.org.springframework.http.ResponseEntity<?>updateListOrder(Long id, com.myfood.dto.ListOrder entity) Updates an existing list order with the provided details.
-
Constructor Details
-
ListOrderController
public ListOrderController()
-
-
Method Details
-
getAllListOrders
@PreAuthorize("hasRole(\'ADMIN\')") @GetMapping("/list-orders") public org.springframework.http.ResponseEntity<org.springframework.data.domain.Page<com.myfood.dto.ListOrder>> getAllListOrders(@RequestParam(defaultValue="0") int page, @RequestParam(defaultValue="10") int size) Retrieves a list of all list orders with user information excluding passwords. It's for ADMIN- Returns:
- ResponseEntity containing a list of
ListOrderobjects with user information excluding passwords. - See Also:
-
ListOrderService#getAllListOrders()ListOrder
-
getOneListOrder
@PreAuthorize("hasRole(\'ADMIN\')") @GetMapping("/list-order/{id}") public org.springframework.http.ResponseEntity<?> getOneListOrder(@PathVariable(name="id") Long id) Retrieves details of a specific list order identified by its ID. It's for ADMIN- Parameters:
id- The unique identifier of the list order.- Returns:
- ResponseEntity containing the details of the list order as a
ListOrderobject with user information excluding passwords. - Throws:
DataNotFoundException- If the specified list order does not exist.- See Also:
-
ListOrderService#getOneListOrder(Long)ListOrder
-
getOrdersByOrderId
@GetMapping("/list-order/orderid/{orderId}") public org.springframework.http.ResponseEntity<?> getOrdersByOrderId(@PathVariable(name="orderId") Long orderId, @RequestParam(defaultValue="0") int page, @RequestParam(defaultValue="10") int size) Retrieves a paginated list of list orders associated with a specific order ID.- Parameters:
orderId- The unique identifier of the order.page- The page number (default is 0).size- The number of elements per page (default is 10).- Returns:
- ResponseEntity containing a paginated list of
ListOrderobjects associated with the specified order ID. - See Also:
-
ListOrderService#getListOrdersByOrderId(Long, Pageable)ListOrder
-
saveListOrder
@PreAuthorize("hasRole(\'ADMIN\')") @PostMapping("/list-order") public org.springframework.http.ResponseEntity<com.myfood.dto.ListOrder> saveListOrder(@RequestBody com.myfood.dto.ListOrder entity) Creates a new list order based on the provided details. It's for ADMIN- Parameters:
entity- The list order details provided in the request body.- Returns:
- ResponseEntity containing the details of the created list order as a
ListOrderobject with user information excluding passwords. - See Also:
-
ListOrderService#createListOrder(ListOrder)ListOrder
-
updateListOrder
@PreAuthorize("hasRole(\'ADMIN\')") @PutMapping("/list-order/{id}") public org.springframework.http.ResponseEntity<?> updateListOrder(@PathVariable(name="id") Long id, @RequestBody com.myfood.dto.ListOrder entity) Updates an existing list order with the provided details. It's for ADMIN- Parameters:
id- The identifier of the list order to be updated.entity- The updated list order details provided in the request body.- Returns:
- ResponseEntity containing the details of the updated list order as a
ListOrderobject with user information excluding passwords. - See Also:
-
ListOrderService#getOneListOrder(Long)ListOrderService#updateListOrder(ListOrder)ListOrder
-
deleteListOrder
@PreAuthorize("hasRole(\'ADMIN\')") @DeleteMapping("/list-order/{id}") public org.springframework.http.ResponseEntity<?> deleteListOrder(@PathVariable(name="id") Long id) Deletes an existing list order based on the provided list order ID. It's for ADMIN- Parameters:
id- The identifier of the list order to be deleted.- Returns:
- ResponseEntity indicating the success or failure of the delete operation.
- See Also:
-
ListOrderService#getOneListOrder(Long)ListOrderService#deleteListOrder(Long)
-
saveListOrder
@PostMapping("/list-order/{orderid}/{itemid}") public org.springframework.http.ResponseEntity<?> saveListOrder(@PathVariable(name="orderid") Long orderid, @PathVariable(name="itemid") Long itemid, @RequestParam(name="itemType") String itemType) Creates a new list order based on the provided order ID, item ID, and item type.- Parameters:
orderid- The identifier of the order associated with the list order.itemid- The identifier of the item associated with the list order (dish or menu).itemType- The type of the item ("dish" or "menu").- Returns:
- ResponseEntity containing the details of the created list order as a
ListOrderobject. - See Also:
-
OrderService#getOneOrder(Long)DishService#getOneDish(Long)MenuService#getOneMenu(Long)ListOrderService#createListOrder(ListOrder)ListOrder
-