diff --git a/src/main/java/Team5/SmartTowns/data/LocationsCoordinatesRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/data/LocationsCoordinatesRepositoryJDBC.java index 7f5bf341bcd825ac22c673b40afae3146a41d680..2966dcef800160692c80f87ae84c64b0f2f1ac27 100644 --- a/src/main/java/Team5/SmartTowns/data/LocationsCoordinatesRepositoryJDBC.java +++ b/src/main/java/Team5/SmartTowns/data/LocationsCoordinatesRepositoryJDBC.java @@ -5,7 +5,9 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Repository; +import java.util.ArrayList; import java.util.List; +import java.util.Objects; @Repository public class LocationsCoordinatesRepositoryJDBC implements LocationsCoordinatesRepository{ @@ -50,9 +52,365 @@ public class LocationsCoordinatesRepositoryJDBC implements LocationsCoordinatesR // public static void before2() { // locationRepo = new locationRepositoryJDBC(jdbc); } - public void approveLocationAndAddCoords(String town, String longCoords, String latCoords){ // need list too + // Method used to approve and add locations with associated coordinates. List<Location> unapprovedLocations + public void approveLocationAndAddCoords(int locationID, String longCoords, String latCoords){ // need list too + String +// List<String> unapprovedLocationTowns = new ArrayList<String>(); +// for (int i=1;unapprovedLocations.size()>i;i++ ){ +// if (Objects.equals(unapprovedLocations.get(i).getLocationPlace(), town)){ -// List<Location> needApprovalList = .unapprovedLocations(); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + } + +// // unapproved list // if matches name, approve // add long/lat coords diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql index 854e13dc2438c1f590c25bee196b07d62c0d670f..e7b4ea8d48706d3dd5f341684409662fc5346dc1 100644 --- a/src/main/resources/schema.sql +++ b/src/main/resources/schema.sql @@ -81,3 +81,14 @@ create table if not exists locationCoordinates )engine=InnoDB; +drop table if exists townsWithTrails; +create table if not exists townsWithTrails +( + townID bigint auto_increment primary key, + townName varchar(128), + townCoordsLong varchar(128), + townCoordsLat varchar(128) + + +)engine=InnoDB; +