mirror of
https://github.com/PaulReichmuth/timekeep-backend.git
synced 2025-12-22 14:41:57 +00:00
add utility methods
This commit is contained in:
@@ -38,9 +38,14 @@ public class RacerService {
|
||||
racer.setFirstName(firstName);
|
||||
racer.setLastName(lastName);
|
||||
racer.setIsFirstSemester(isFirstSemester);
|
||||
checkRacerIsDuplicate(racer);
|
||||
return racerRepository.save(racer);
|
||||
}
|
||||
|
||||
public List<Racer> getAllRacers(){
|
||||
return racerRepository.findAll();
|
||||
}
|
||||
|
||||
public Racer getRacer(String firstName, String lastName) throws RacerNotFoundException {
|
||||
Racer racer = racerRepository.getRacerByFirstName(firstName).orElse(null);
|
||||
if(racer == null) throw new RacerNotFoundException(String.format("Racer with name %s %s not found", firstName, lastName));
|
||||
|
||||
Reference in New Issue
Block a user