fix some wrong

This commit is contained in:
esmailian
2025-04-29 17:53:21 +03:30
parent 074e802a7d
commit 19c09c52b9
3 changed files with 2 additions and 37 deletions

View File

@ -17,7 +17,7 @@ public class OrderCommandHandler {
this.orderRepository = orderRepository;
}
public void createUser(CreateOrderCommand createOrderCommand) {
public void createOrder(CreateOrderCommand createOrderCommand) {
OrderEntity orderEntity = new OrderEntity();
orderEntity.setId(createOrderCommand.getOrderId());
orderEntity.setOrderName(createOrderCommand.getOrderName());

View File

@ -32,7 +32,7 @@ public class OrderController {
@CrossOrigin(origins = "http://localhost:3001")
@PostMapping("/create")
public ResponseEntity<?> create(@Valid @RequestBody CreateOrderCommand orderCommand) {
orderCommandHandler.createUser(orderCommand);
orderCommandHandler.createOrder(orderCommand);
return ResponseEntity.ok(200);
}
}

View File

@ -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);
}
}