Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team5 Sports League application
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haoyu Sun
Team5 Sports League application
Commits
c8298047
Commit
c8298047
authored
9 months ago
by
Haoyu Sun
Browse files
Options
Downloads
Patches
Plain Diff
try to use session
parent
ae7b1fcb
Branches
Branches containing commit
No related tags found
1 merge request
!54
Resolve "As an administrator, I want to generate the matches automatically so that players are divided by the program"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/uk/ac/cf/spring/demo/sports/match/MatchController.java
+22
-4
22 additions, 4 deletions
...va/uk/ac/cf/spring/demo/sports/match/MatchController.java
with
22 additions
and
4 deletions
src/main/java/uk/ac/cf/spring/demo/sports/match/MatchController.java
+
22
−
4
View file @
c8298047
package
uk.ac.cf.spring.demo.sports.match
;
import
jakarta.servlet.http.HttpSession
;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.stereotype.Controller;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
//import org.springframework.web.servlet.ModelAndView;
...
...
@@ -17,12 +20,12 @@ public class MatchController {
}
// get all Match List
@GetMapping
public
List
<
MatchItem
>
getAllM
enu
Items
()
{
public
List
<
MatchItem
>
getAllM
atch
Items
()
{
return
matchService
.
getMatchItems
();
}
// get Match by id
@GetMapping
(
"/{id}"
)
public
MatchItem
getM
enu
Item
(
@PathVariable
Long
id
)
{
public
MatchItem
getM
atch
Item
(
@PathVariable
Long
id
)
{
return
matchService
.
getMatchItemById
(
id
);
}
...
...
@@ -44,8 +47,23 @@ public class MatchController {
public
void
deleteMatchItem
(
@PathVariable
Long
id
)
{
matchService
.
deleteMatchItem
(
id
);
}
//fail to come true
// @PutMapping("/{id}")
// public ResponseEntity<String> updateMatchItem(@PathVariable Long id, @RequestBody MatchItem matchItem, HttpSession session) {
// Long userId = (Long) session.getAttribute("userId");
// if (userId == null) {
// return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("{\"message\": \"User not logged in\"}");
// }
// if(matchItem.getPlayerAId() == 0) {
// matchItem.setPlayerAId(userId);
// }else {
// matchItem.setPlayerBId(userId);
// }
//
// matchItem.setId(id);
// matchService.updateMatchItem(matchItem);
// return ResponseEntity.ok("{\"message\": \"Match added successfully\"}");
// }
// @GetMapping("/match")
// public ModelAndView getMatch() {
// ModelAndView modelAndView = new ModelAndView("match/allMatchList");
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment