fix some wrong
This commit is contained in:
@ -17,7 +17,7 @@ public class OrderCommandHandler {
|
|||||||
this.orderRepository = orderRepository;
|
this.orderRepository = orderRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createUser(CreateOrderCommand createOrderCommand) {
|
public void createOrder(CreateOrderCommand createOrderCommand) {
|
||||||
OrderEntity orderEntity = new OrderEntity();
|
OrderEntity orderEntity = new OrderEntity();
|
||||||
orderEntity.setId(createOrderCommand.getOrderId());
|
orderEntity.setId(createOrderCommand.getOrderId());
|
||||||
orderEntity.setOrderName(createOrderCommand.getOrderName());
|
orderEntity.setOrderName(createOrderCommand.getOrderName());
|
||||||
|
@ -32,7 +32,7 @@ public class OrderController {
|
|||||||
@CrossOrigin(origins = "http://localhost:3001")
|
@CrossOrigin(origins = "http://localhost:3001")
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public ResponseEntity<?> create(@Valid @RequestBody CreateOrderCommand orderCommand) {
|
public ResponseEntity<?> create(@Valid @RequestBody CreateOrderCommand orderCommand) {
|
||||||
orderCommandHandler.createUser(orderCommand);
|
orderCommandHandler.createOrder(orderCommand);
|
||||||
return ResponseEntity.ok(200);
|
return ResponseEntity.ok(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
package com.example.mmad.testapp.controller;
|
|
||||||
|
|
||||||
import com.example.mmad.testapp.command.CreateOrderCommand;
|
|
||||||
import com.example.mmad.testapp.command.OrderCommandHandler;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/user")
|
|
||||||
public class UserController {
|
|
||||||
|
|
||||||
private OrderCommandHandler userCommandHandler;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public void setPersonService(OrderCommandHandler userCommandHandler) {
|
|
||||||
this.userCommandHandler = userCommandHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/list")
|
|
||||||
@ResponseStatus(HttpStatus.OK)
|
|
||||||
public String listPosts() {
|
|
||||||
return "userHandler";
|
|
||||||
}
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:3001")
|
|
||||||
@PostMapping("/create")
|
|
||||||
public ResponseEntity<?> create(@Valid @RequestBody CreateOrderCommand userCommand) {
|
|
||||||
userCommandHandler.createUser(userCommand);
|
|
||||||
return ResponseEntity.ok(200);
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user