Change method name

This commit is contained in:
Peter Rossa
2023-05-11 13:05:15 +02:00
parent 995e90acd5
commit 54905ed995

View File

@@ -25,12 +25,12 @@ public class MeterController {
private MeterRepository meterRepository; private MeterRepository meterRepository;
@RequestMapping(value = "/meters", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/meters", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<Meter> getAllEmployees() { public List<Meter> getAllMeters() {
return meterRepository.findAll(); return meterRepository.findAll();
} }
@RequestMapping(value = "/meters/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/meters/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Meter> getEmployeeById(@PathVariable(value = "id") long meterId) public ResponseEntity<Meter> getMeterById(@PathVariable(value = "id") long meterId)
throws ResourceNotFoundException { throws ResourceNotFoundException {
Meter meter = meterRepository.findById(meterId) Meter meter = meterRepository.findById(meterId)
.orElseThrow(() -> new ResourceNotFoundException("Meter not found for this id :: " + meterId)); .orElseThrow(() -> new ResourceNotFoundException("Meter not found for this id :: " + meterId));