Skip to content

Commit

Permalink
fix endpoints name
Browse files Browse the repository at this point in the history
  • Loading branch information
SAMUEL BRISTOT LOLI committed Apr 3, 2022
1 parent e88019a commit dda343d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ public class EmployeeController {
@Autowired
private EmployeeService employeeService;

@PostMapping("/employess/")
@PostMapping("/employees/")
public ResponseEntity<Employee> save(@RequestBody EmployeeDto employeeDto, UriComponentsBuilder uriBuilder){
Employee employee = employeeService.save(employeeDto);
URI uri = uriBuilder.path("/employees/{id}").buildAndExpand(employee.getId()).toUri();
return ResponseEntity.created(uri).body(employee);
}

@GetMapping("/employess/")
@GetMapping("/employees/")
public ResponseEntity<List<Employee>> getAll(){
return ResponseEntity.ok(employeeService.getAll());
}

@GetMapping("/employess/{id}")
@GetMapping("/employees/{id}")
public ResponseEntity<Employee> findById(@PathVariable Integer id){
return ResponseEntity.ok(employeeService.getById(id));
}

@DeleteMapping("/employess/{id}")
@DeleteMapping("/employees/{id}")
public ResponseEntity<Void> delete(@PathVariable Integer id){
employeeService.delete(id);
return ResponseEntity.ok().build();
Expand Down

0 comments on commit dda343d

Please sign in to comment.