From 1aaca182ff211b5b9ec1daa7c90f3172e287599a Mon Sep 17 00:00:00 2001 From: c22122192 <XiaoX16@cardiff.ac.uk> Date: Thu, 5 Dec 2024 13:54:02 +0000 Subject: [PATCH] Merge remote-tracking branch 'origin/28-registration-feature' into 28-registration-feature --- .../sports/match/MatchItemController.java | 61 ------------------- .../sports/match/MatchItemRepository.java | 19 ------ .../demo/sports/match/MatchItemService.java | 26 -------- src/main/resources/static/html/navBar.html | 4 +- 4 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemController.java delete mode 100644 src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemRepository.java delete mode 100644 src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemService.java diff --git a/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemController.java b/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemController.java deleted file mode 100644 index 41e0e33..0000000 --- a/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemController.java +++ /dev/null @@ -1,61 +0,0 @@ -package uk.ac.cf.spring.demo.sports.match; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Map; - -@RestController -@RequestMapping("/admin/matchitems") -public class MatchItemController { - - @Autowired - private MatchItemService matchItemService; - - @GetMapping - public List<Map<String, Object>> getAllMatchItems() { - return matchItemService.getAllMatchItems(); - } - - @PutMapping("/{id}") - public void updateMatchItemScore(@PathVariable long id, @RequestBody MatchItemUpdateRequest request) { - matchItemService.updateMatchItemScore(id, request.getScoreA(), request.getScoreB(), request.getWinnerId()); - } - - @DeleteMapping("/{id}") - public void deleteMatchItem(@PathVariable long id) { - matchItemService.deleteMatchItem(id); - } -} - -class MatchItemUpdateRequest { - private int scoreA; - private int scoreB; - private long winnerId; - - // Getters and setters - public int getScoreA() { - return scoreA; - } - - public void setScoreA(int scoreA) { - this.scoreA = scoreA; - } - - public int getScoreB() { - return scoreB; - } - - public void setScoreB(int scoreB) { - this.scoreB = scoreB; - } - - public long getWinnerId() { - return winnerId; - } - - public void setWinnerId(long winnerId) { - this.winnerId = winnerId; - } -} diff --git a/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemRepository.java b/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemRepository.java deleted file mode 100644 index 11ca20f..0000000 --- a/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package uk.ac.cf.spring.demo.sports.match; - -import java.util.List; - -public interface MatchItemRepository { - // get match items - List<MatchItem> getMatchItems(); - // get Match Item by id - MatchItem getMatchItemById(Long id); - // get MatchItem by sport - List<MatchItem> getMatchItemBySport(String sport); - // add MatchItem - void addMatchItem(MatchItem matchItem); - // update MatchItem - void updateMatchItem(MatchItem matchItem); - // delete MatchItem - void deleteMatchItem(Long id); - -} \ No newline at end of file diff --git a/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemService.java b/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemService.java deleted file mode 100644 index acb2dbb..0000000 --- a/src/main/java/uk/ac/cf/spring/demo/sports/match/MatchItemService.java +++ /dev/null @@ -1,26 +0,0 @@ -package uk.ac.cf.spring.demo.sports.match; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; - -@Service -public class MatchItemService { - - @Autowired - private MatchItemRepository matchItemRepository; - - public List<Map<String, Object>> getAllMatchItems() { - return matchItemRepository.getAllMatchItems(); - } - - public void updateMatchItemScore(long matchId, int scoreA, int scoreB, long winnerId) { - matchItemRepository.updateMatchItemScore(matchId, scoreA, scoreB, winnerId); - } - - public void deleteMatchItem(long matchId) { - matchItemRepository.deleteMatchItem(matchId); - } -} diff --git a/src/main/resources/static/html/navBar.html b/src/main/resources/static/html/navBar.html index 1a937f1..1714c60 100644 --- a/src/main/resources/static/html/navBar.html +++ b/src/main/resources/static/html/navBar.html @@ -19,8 +19,8 @@ <!-- <button class="subscribe-btn">Subscribe</button>--> <!-- </div>--> <div class="auth-buttons"> - <a href="html/login.html" class="login-btn">Login</a> - <a href="html/signup.html" class="signup-btn">Sign Up</a> + <a href="http://localhost:8080/html/login.html" class="login-btn">Login</a> + <a href="http://localhost:8080/html/register.html" class="signup-btn">Sign Up</a> <a href="html/subscribe.html" class="subscribe-btn">Subscribe</a> </div> -- GitLab