Skip to content
Snippets Groups Projects
Commit cc2b827d authored by Rhys Nute's avatar Rhys Nute
Browse files

Updated

parents 092d7144 6464aaa8
No related branches found
No related tags found
1 merge request!31Resolve "As a user, I want to see a page of local authorities so that I can easily source contact details for a variety of different local authorities."
......@@ -33,16 +33,15 @@ public class organisationControllers {
@Autowired
private localAuthorityRepository localAuthorityRepository;
@PostMapping("/localForm")
public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) {
if (bindingResult.hasErrors()){
ModelAndView modelAndView = new ModelAndView("localForm", model.asMap());
public ModelAndView localAuthoritySent(@Valid @ModelAttribute("local-auth-data")localAuthority localAuthority, BindingResult bindingResult, Model model ) {
if (bindingResult.hasErrors()) {
ModelAndView modelAndView = new ModelAndView("business-data", model.asMap());
return modelAndView;
}else{// converts user input using the organisation constructor into a submittable format to the sql table
localAuthority loc = new localAuthority(localAuthority.getLocalAuthorityName(), localAuthority.getAddress1(), localAuthority.getAddress2(), localAuthority.getCity(), localAuthority.getCounty(), localAuthority.getPostcode(), localAuthority.getWebsite());
System.out.println(loc);
localAuthorityRepository.addLocalAuthority(loc); //add local authority to local authority table
ModelAndView modelAndView = new ModelAndView("redirect:/local-authorities");
ModelAndView modelAndView = new ModelAndView("redirect:/localauthority");
return modelAndView;
}
}
......
......@@ -41,16 +41,16 @@ public class LocationRepositoryJDBC implements LocationRepository {
String sql= "SELECT * FROM locations";
return jdbc.query(sql, locationMapper);
}
// public LocationRepositoryJDBC() {
// JdbcTemplate ajdbc = new JdbcTemplate();
// this.jdbc =ajdbc;
// setlocationMapper();
//
// }
// public LocationRepositoryJDBC(JdbcTemplate jdbc, RowMapper<Location> locationMapper) {
// this.jdbc = jdbc;
// this.locationMapper = locationMapper;
// }
public LocationRepositoryJDBC() {
JdbcTemplate ajdbc = new JdbcTemplate();
this.jdbc =ajdbc;
setlocationMapper();
}
public LocationRepositoryJDBC(JdbcTemplate jdbc, RowMapper<Location> locationMapper) {
this.jdbc = jdbc;
this.locationMapper = locationMapper;
}
@Override
public List<Location> getAllApprovedLocations(){
......
......@@ -5,6 +5,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.JdbcUserDetailsManager;
......@@ -23,6 +24,7 @@ public class SecurityConfiguration {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests((requests) -> requests
.requestMatchers("/user/**", "/userProfile").authenticated()
.anyRequest().permitAll()
......
......@@ -51,6 +51,7 @@ insert into badgeprogress (userID, badgeID, progress) value ('1', '1', '40');
insert into badgeprogress (userID, badgeID, progress) value ('1', '2', '70');
insert into badgeprogress (userID, badgeID, progress) value ('2', '2', '70');
<<<<<<< HEAD
delete from stickerprogress;
insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '1', true);
insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '3', true);
......@@ -59,4 +60,63 @@ insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', tru
delete from localauthority;
insert into localauthority ( localAuthorityName, address1, address2, city, county, postcode, website) value ( 'Caerphilly County Borough Council', 'Tredomen Park','', 'Ystrad Mynach, Hengoed', '', 'CF82 7PG', 'https://www.caerphilly.gov.uk/main.aspx?lang=en-GB');
insert into localauthority ( localAuthorityName, address1, address2, city, county, postcode, website) value ( 'Risca Town Council', 'Unit B, 75 Tredegar Street', '', 'Risca', '', 'NP11 6BW', 'https://www.riscatowncouncil.org.uk/');
insert into localauthority ( localAuthorityName, address1, address2, city, county, postcode, website) value ( 'Penarth Town Council West House', 'Stanwell Road', '', 'Penarth', '', 'CF64 2YG', 'https://www.penarthtowncouncil.gov.uk/your-council/');
\ No newline at end of file
insert into localauthority ( localAuthorityName, address1, address2, city, county, postcode, website) value ( 'Penarth Town Council West House', 'Stanwell Road', '', 'Penarth', '', 'CF64 2YG', 'https://www.penarthtowncouncil.gov.uk/your-council/');
=======
delete from packs;
insert into packs (name, description) value ('Wales Football Team', 'Pack of Welsh Football Players in the National Team');
insert into packs (name, description) value ('Wales Rugby Team', 'Pack of Welsh Rugby Players in the National Team');
insert into packs (name, description) value ('Welsh Heritage', 'Pack About Welsh Heritage');
DELETE FROM stickers;
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (1, 1, 'wayne_hennessey', 'Wales Football Team Player', '2');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (1, 2, 'neco_williams', 'Wales Football Team Player', '2');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (1, 3, 'joe_morrell', 'Wales Football Team Player', '2');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (1, 4, 'ethan_ampadu', 'Wales Football Team Player', '2');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (1, 5, 'connor_roberts', 'Wales Football Team Player', '2');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (2, 1, 'Taine_Basham', 'Wales Rugby Team Player', '1');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (2, 2, 'Adam Beard', 'Wales Rugby Team Player', '1');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (2, 3, 'Elliot Dee', 'Wales Rugby Team Player', '1');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (2, 4, 'Corey Domachowski', 'Wales Rugby Team Player', '1');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (2, 5, 'Ryan Elias', 'Wales Rugby Team Player', '1');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (3, 1, 'Welsh Lady', 'Welsh Heritage', '1');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (3, 2, 'Welsh Outline', 'Welsh Heritage', '1');
INSERT INTO stickers (packID, stickerID, name, description, rarity) VALUE (3, 3, 'Welsh Spoon', 'Welsh Heritage', '1');
# delete from stickerprogress;
# insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '1', true);
# insert into stickerprogress (userID, stickerID, hasSticker) value ('1', '3', true);
# insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true);
delete from locationCoordinates;
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (2, 51.57623, -3.21910 );
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (3, 51.575372, -3.219186);
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (4, 51.576363, -3.220712 );
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (9, 51.57239, -3.21992);
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (10, 51.57230, -3.21938 );
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (13, 51.57168, -3.21861);
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (14, 51.57465, -3.22022 );
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (17, 51.61117, -3.10198 );
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (18, 51.61655, -3.12371 );
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (19, 51.43484, -3.16492 );
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (20, 51.43547, -3.16789 );
# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 1);
# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 2);
# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 3);
# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 5);
# insert into stickerprogress (userID, packID, stickerID) value (1, 2, 1);
# insert into stickerprogress (userID, packID, stickerID) value (1, 2, 3);
#
delete from townsWithTrails;
insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Caerphilly', '51.57903','-3.22075 ','51.60418','51.55093','-3.25222','-3.17696');
insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Risca','51.61195','-3.09648','51.63039','51.59175','-3.12129','-3.06438');
insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Penarth','51.43893','-3.17354','51.44878','51.41233','-3.20271','-3.16005');
>>>>>>> 6464aaa8419c280b353cd943e44f8b09d831da64
......@@ -70,4 +70,31 @@ create table if not exists localAuthority
county varchar(75),
postcode varchar(15),
website varchar(250)
) engine=InnoDB;
\ No newline at end of file
) engine=InnoDB;
=======
locationCoordID bigint auto_increment primary key,
locationID bigint,
Foreign Key (locationID) REFERENCES locations(locationID)
ON DELETE CASCADE
ON UPDATE RESTRICT,
locationCoordsLat DECIMAL(8,6),
locationCoordsLong DECIMAL(8,6)
)engine=InnoDB;
drop table if exists townsWithTrails;
create table if not exists townsWithTrails
(
townID bigint auto_increment primary key,
townName varchar(128),
townCentreCoordsLat varchar(128),
townCentreCoordsLong varchar(128),
townUppermostCoordsLat varchar(128),
townLowermostCoordsLat varchar(128),
townLeftmostCoordsLong varchar(128),
townRightmostCoordsLong varchar(128)
)engine=InnoDB;
......@@ -10,6 +10,7 @@
<li>FAQs</li>
<li>Contact us</li>
</ul>
<<<<<<< HEAD
<label class="work">Who we Work with:</label>
<select>
<ul>
......@@ -18,6 +19,14 @@
<option value="businesses">Businesses</option>
<option value="consumers">Consumers</option>
</ul>
=======
<label for="stakeholders" class="work">Who we Work with:</label>
<select id="stakeholders">
<option value="localauthorities">Local Authorities</option>
<option value="towns">Towns</option>
<option value="businesses">Businesses</option>
<option value="consumers">Consumers</option>
>>>>>>> 6464aaa8419c280b353cd943e44f8b09d831da64
</select>
</nav>
</header>
......
......@@ -6,7 +6,7 @@
<link rel="stylesheet" th:href="@{css/localAuthorityPageStyle.css}">
<link rel="stylesheet" th:href="@{css/templatingstyle.css}">
</head>
<header th:insert="~{/towns/Templating.html::header}"></header>
<header th:insert="fragments/Templating.html :: header"></header>
<body>
<h1>Local Authorities</h1>
<div id="councils">
......@@ -15,6 +15,6 @@
</ul>
</div>
<button><a href="/localForm" id="authority">Local Authorities please enter here</a></button>
<footer th:insert="~{/towns/Templating.html::footer}"></footer>
<div th:insert="fragments/Templating.html :: footer"></div>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment