Commit 1b82c0bc authored by Nikitha Moosapet's avatar Nikitha Moosapet

[nmoosapet]Implemented Order-History Functionality to get the order history by...

[nmoosapet]Implemented Order-History Functionality to get the order history by userId from OMS product team
parent fbaaa806
......@@ -5,6 +5,7 @@ import com.nisum.ecomservice.dto.OrderRequest;
import com.nisum.ecomservice.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@RestController
......@@ -18,6 +19,8 @@ public class OrdersController {
private Mono<Order> postOrder(@RequestBody OrderRequest orderRequest){
return orderService.postOrder(orderRequest);
}
@GetMapping("/byUser/{userId}")
private Flux<Order> getUserOrderHistory(@PathVariable String userId){
return orderService.getOrderFromOmsAPI(userId);
}
}
......@@ -81,6 +81,13 @@ public class OrderService {
.retrieve()
.bodyToMono(Order.class);
}
public Flux<Order> getOrderFromOmsAPI(String userId){
return WebClient.create(String.format("%s/orders/byCustomer/%s", AppConfig.getOrderManagementAPI(),userId))
.get()
.retrieve()
.bodyToFlux(Order.class);
}
}
/*
.map(productMono -> {
......
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