fixed a bug with deleteCache
This commit is contained in:
parent
9828f88f7b
commit
16cae0ba90
@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.lang.reflect.Array;
|
||||
import java.security.Key;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.*;
|
||||
@ -201,7 +202,7 @@ public class Controller {
|
||||
public ResponseEntity createCache(@RequestBody Cache cache) {
|
||||
System.out.println(cache.getName());
|
||||
System.out.println(cache.getStationen().size());
|
||||
System.out.println(cache.getStationen().get(0).getId());
|
||||
// System.out.println(cache.getStationen().get(0).getId());
|
||||
// Stationen werden in die Datenbank eingetragen
|
||||
for (Station station : cache.getStationen()) {
|
||||
ResponseEntity response = createStation(station);
|
||||
@ -335,12 +336,18 @@ public class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<Station> stationen = new ArrayList<>();
|
||||
for (Station station : cache.getStationen()) {
|
||||
stationRepository.delete(station);
|
||||
stationen.add(stationRepository.findById(station.getId()).get());
|
||||
}
|
||||
|
||||
cacheRepository.delete(cache);
|
||||
|
||||
for (Station station : stationen) {
|
||||
stationRepository.delete(station);
|
||||
}
|
||||
|
||||
|
||||
return ResponseEntity.status(200).body(new Gson().toJson(true));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user