Create Service, Entity and Repository for Client and Location. Client add test to BDD done

This commit is contained in:
Olivier PARPAILLON
2025-07-09 10:00:21 +02:00
parent c226657ca6
commit b2fffa9f9f
11 changed files with 158 additions and 11 deletions

View File

@@ -0,0 +1,25 @@
package fr.eni.demo.bll;
import fr.eni.demo.bo.Location;
import fr.eni.demo.dal.LocationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class LocationService {
@Autowired
LocationRepository locationRepository;
public void add(Location location) {
if (location.getRue() == null || location.getCodePostal() == null || location.getVille() == null) {
Location locationTest = new Location();
locationTest.setRue("18 Rue de la Paix");
locationTest.setCodePostal("75000");
locationTest.setVille("Paris");
locationRepository.save(locationTest);
} else {
locationRepository.save(location);
}
}
}