Noch mehr in CacheContruction
This commit is contained in:
parent
efa5e5b954
commit
1960fc4356
@ -130,7 +130,7 @@ public class CacheConstructionUtil {
|
||||
oldCache = oldCacheOptional.get();
|
||||
// oldStationen = new ArrayList<>(oldCache.getStationen());
|
||||
} else {
|
||||
return ResponseEntity.status(404).body("There isnt a cache with the id " + cache.getId());
|
||||
return ResponseEntity.status(404).body("Es gab einen Fehler. Bitte versuchen Sie es erneut oder kontaktieren Sie einen Admin.");
|
||||
}
|
||||
|
||||
ResponseEntity response = new ResponseEntity(HttpStatus.ACCEPTED);
|
||||
@ -168,26 +168,26 @@ public class CacheConstructionUtil {
|
||||
// überprüft den Cache nach validen Daten
|
||||
if (cache.getDescription().length() == 0 || cache.getName().length() == 0 || cache.getRankingPoints() == 0.0) {
|
||||
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||
return ResponseEntity.status(400).body("cache fields can´t be empty");
|
||||
return ResponseEntity.status(400).body("Alle Felder müssen ausgefüllt sein!");
|
||||
}
|
||||
|
||||
if (cache.getStationen().size() < 2) {
|
||||
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||
return ResponseEntity.status(400).body("a cache needs atleast 2 stations");
|
||||
return ResponseEntity.status(400).body("Ein Cache muss mindestens zwei Stationen haben. Bitte füge eine weiter Station hinzu!");
|
||||
}
|
||||
|
||||
for (Cache cache1 : cacheRepository.findAll()) {
|
||||
if (cache1.getName().equals(cache.getName())) {
|
||||
if (cache1.getId() != oldCache.getId()) {
|
||||
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||
return ResponseEntity.status(400).body("name is already taken");
|
||||
return ResponseEntity.status(400).body("Der Cachename ist bereits vergeben. Bitte wähle einen anderen!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cache.getRankingPoints() < 0) {
|
||||
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||
return ResponseEntity.status(400).body("Ranking points has to be a positive number");
|
||||
return ResponseEntity.status(400).body("Die Punkte für den Cache dürfen nicht negativ sein!");
|
||||
}
|
||||
|
||||
cacheRepository.save(cache);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user