@RestController
@RequestMapping("po")
@ConditionalOnProperty(name = "app.write.enabled", havingValue = "true")
public class OrderCommandController {
@Autowired
private OrderCommandService orderCommandService;
@PostMapping("/sale")
public void placeOrder(@RequestBody OrderCommandDto dto){
this.orderCommandService.createOrder(dto.getUserIndex(), dto.getProductIndex());
}
@PutMapping("/cancel-order/{orderId}")
public void cancelOrder(@PathVariable long orderId){
this.orderCommandService.cancelOrder(orderId);
}
}