a cache needs atleast 2 stations

This commit is contained in:
Michael 2019-04-18 14:38:20 +02:00
parent 48275e09f1
commit deb50cad9c

View File

@ -52,11 +52,16 @@ public class CacheConstructionUtil {
}
// Caches werden in die Datenbank eingetragen
if (cache.getDescription().length() == 0 || cache.getName().length() == 0 || cache.getRankingPoints() == 0.0 || cache.getStationen().size() == 0) {
if (cache.getDescription().length() == 0 || cache.getName().length() == 0 || cache.getRankingPoints() == 0.0) {
deleteStationenUtil(cache);
return ResponseEntity.status(400).body("cache fields can´t be empty");
}
if (cache.getStationen().size() < 2) {
deleteStationenUtil(cache);
return ResponseEntity.status(400).body("a cache needs atleast 2 stations");
}
for (Cache cache1 : cacheRepository.findAll()) {
if (cache1.getName().equals(cache.getName())) {
deleteStationenUtil(cache);