a cache needs atleast 2 stations
This commit is contained in:
parent
48275e09f1
commit
deb50cad9c
@ -52,11 +52,16 @@ public class CacheConstructionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Caches werden in die Datenbank eingetragen
|
// 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);
|
deleteStationenUtil(cache);
|
||||||
return ResponseEntity.status(400).body("cache fields can´t be empty");
|
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()) {
|
for (Cache cache1 : cacheRepository.findAll()) {
|
||||||
if (cache1.getName().equals(cache.getName())) {
|
if (cache1.getName().equals(cache.getName())) {
|
||||||
deleteStationenUtil(cache);
|
deleteStationenUtil(cache);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user