removed stationReihenfolge database table, because its not needed
This commit is contained in:
parent
3d78f0bc42
commit
e86aa6adc2
@ -40,9 +40,6 @@ public class Controller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
UserRepository userRepository;
|
UserRepository userRepository;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
StationReihenfolgeRepository stationReihenfolgeRepository;
|
|
||||||
|
|
||||||
private AtomicLong counter = new AtomicLong();
|
private AtomicLong counter = new AtomicLong();
|
||||||
|
|
||||||
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
@CrossOrigin(origins = "http://localhost:8081") // only for dev purpose
|
||||||
@ -177,14 +174,6 @@ public class Controller {
|
|||||||
|
|
||||||
cacheRepository.save(cache);
|
cacheRepository.save(cache);
|
||||||
|
|
||||||
for (int i = 0; i + 1 < cache.getStationen().size(); i++) {
|
|
||||||
StationReihenfolge stationReihenfolge = new StationReihenfolge();
|
|
||||||
stationReihenfolge.setCache(cache);
|
|
||||||
stationReihenfolge.setStation(cache.getStationen().get(i));
|
|
||||||
stationReihenfolge.setNachfolgeStation(cache.getStationen().get(i + 1));
|
|
||||||
stationReihenfolgeRepository.save(stationReihenfolge);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseEntity.status(200).body(new Gson().toJson(cache));
|
return ResponseEntity.status(200).body(new Gson().toJson(cache));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,12 +259,6 @@ public class Controller {
|
|||||||
|
|
||||||
Cache cache = optionalCache.get();
|
Cache cache = optionalCache.get();
|
||||||
|
|
||||||
for (StationReihenfolge stationReihenfolge : stationReihenfolgeRepository.findAll()) {
|
|
||||||
if (stationReihenfolge.getCache().getId() == cache.getId()) {
|
|
||||||
stationReihenfolgeRepository.delete(stationReihenfolge);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Bearbeitet bearbeitet : bearbeitetRepository.findAll()) {
|
for (Bearbeitet bearbeitet : bearbeitetRepository.findAll()) {
|
||||||
if (bearbeitet.getCache().getId() == cache.getId()) {
|
if (bearbeitet.getCache().getId() == cache.getId()) {
|
||||||
bearbeitetRepository.delete(bearbeitet);
|
bearbeitetRepository.delete(bearbeitet);
|
||||||
|
|||||||
@ -1,53 +0,0 @@
|
|||||||
package hhn.labsw.bugageocaching.entities;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table
|
|
||||||
public class StationReihenfolge {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
private Cache cache;
|
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
private Station station;
|
|
||||||
|
|
||||||
@OneToOne
|
|
||||||
private Station nachfolgeStation;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Cache getCache() {
|
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCache(Cache cache) {
|
|
||||||
this.cache = cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Station getStation() {
|
|
||||||
return station;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStation(Station station) {
|
|
||||||
this.station = station;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Station getNachfolgeStation() {
|
|
||||||
return nachfolgeStation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNachfolgeStation(Station nachfolgeStation) {
|
|
||||||
this.nachfolgeStation = nachfolgeStation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
package hhn.labsw.bugageocaching.repositories;
|
|
||||||
|
|
||||||
import hhn.labsw.bugageocaching.entities.StationReihenfolge;
|
|
||||||
import org.springframework.data.repository.CrudRepository;
|
|
||||||
|
|
||||||
public interface StationReihenfolgeRepository extends CrudRepository<StationReihenfolge, Integer> {
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user