Решена проблема с null`ом в POST запросе
This commit is contained in:
parent
e6923c88ba
commit
7d5d88a16c
@ -4,7 +4,6 @@ import com.example.nekontakte.core.configurations.Constants;
|
||||
import com.example.nekontakte.users.model.UserEntity;
|
||||
import com.example.nekontakte.users.service.UserService;
|
||||
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
@ -15,6 +14,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -50,9 +50,6 @@ public class UserController {
|
||||
|
||||
@PostMapping
|
||||
public UserDTO create(@RequestBody @Valid UserDTO userDTO) {
|
||||
if (userDTO.getName() == null) {
|
||||
throw new RuntimeException("What a f*ck????");
|
||||
}
|
||||
return toDTO(userService.create(toEntity(userDTO)));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user