Commit 06cc8d1b authored by Kevin Kaminski's avatar Kevin Kaminski

Change order routes, add order delete route. Add email functionality.

parent 14c3d9a5
Pipeline #1703 failed with stage
in 38 seconds
......@@ -10,7 +10,7 @@ public class EmailController {
@Autowired
private EmailService emailService;
@GetMapping(value = "/sendmail")
@GetMapping(value = "/email")
public String sendmail() {
emailService.sendMail(
......
......@@ -29,7 +29,7 @@ public class OrderController {
* @param orderObject
* @return
*/
@PostMapping("/ordersFromEcom")
@PostMapping("/orders")
@ResponseStatus(HttpStatus.CREATED)
public Mono<Order> getOrderFromEcom(@RequestBody Order orderObject) {
sender.sendOrderToWarehouse(orderObject);
......@@ -48,7 +48,7 @@ public class OrderController {
return orderService.getOrderById(orderId);
}
@GetMapping("/orders/byCustomer/{customerId}")
@GetMapping("/orders/customer/{customerId}")
public Flux<Order> getAllOrdersByCustomerId(@PathVariable("customerId") String customerId) {
return orderService.getAllOrdersByCustomerId(customerId);
}
......@@ -60,5 +60,9 @@ public class OrderController {
.defaultIfEmpty(ResponseEntity.notFound().build());
}
@DeleteMapping("/orders/{orderId}")
public void deleteOrderbyId(@PathVariable(value = "orderId") String orderId) {
orderService.deleteOrderById(orderId);
}
}
......@@ -50,4 +50,8 @@ public class OrderService {
return orderRepository.save(existingOrder);
});
}
public void deleteOrderById(String orderId) {
orderRepository.deleteById(orderId);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment