From 8e630d66f6cf78e3f96d1dcaa430bd6ee018660b Mon Sep 17 00:00:00 2001
From: Rhys Evans <EvansRM17@cardiff.ac.uk>
Date: Sat, 9 Dec 2023 10:26:22 +0000
Subject: [PATCH]  Furthjer work initilaizsing town lat/long feature for map
 embedding

---
 .../LocationsCoordinatesRepositoryJDBC.java   | 362 +++++++++++++++++-
 src/main/resources/schema.sql                 |  11 +
 2 files changed, 371 insertions(+), 2 deletions(-)

diff --git a/src/main/java/Team5/SmartTowns/data/LocationsCoordinatesRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/data/LocationsCoordinatesRepositoryJDBC.java
index 7f5bf341..2966dcef 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 854e13dc..e7b4ea8d 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;
+
-- 
GitLab