Documentation

This commit is contained in:
Matthias Engelien
2024-09-16 07:59:27 +02:00
parent 86ecf3b317
commit ebc66ff8f6
11 changed files with 188 additions and 49 deletions

View File

@@ -3,19 +3,31 @@ package de.etecture.ga.service;
import java.util.Optional;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import de.etecture.ga.model.Garage;
import de.etecture.ga.repository.GarageRepository;
import lombok.AllArgsConstructor;
/**
* Service to handle all {@link Garage} related tasks
*/
@Service
@AllArgsConstructor
public class GarageService {
private final GarageRepository repository;
public Optional<Garage> getGarage(long id) {
return repository.findById(id);
/**
* Reads the {@link Garage} object for the given id.
*
* @param garageId id of {@link Garage} to read
*
* @return a {@link Garage} for the given id
*/
public Optional<Garage> getGarage(long garageId) {
Assert.isTrue(garageId > 0, "A valid garageId must be given");
return repository.findById(garageId);
}
}