fully documented existing endpoints

This commit is contained in:
2025-12-18 16:09:50 +01:00
parent 55fa371f26
commit 8e247dc2d6

View File

@@ -25,7 +25,7 @@ public class TeamRestController {
private final TeamService teamService; private final TeamService teamService;
///////////////////////////////////////////////////BEGIN POST MAPPINGS/////////////////////////////////////////////////// // ///////////////////////////////////////////////BEGIN POST MAPPINGS///////////////////////////////////////////////////
/** /**
* Creates a team with the information provided via the /teams/createTeam endpoint * Creates a team with the information provided via the /teams/createTeam endpoint
@@ -44,10 +44,11 @@ public class TeamRestController {
} }
///////////////////////////////////////////////////BEGIN GET MAPPINGS/////////////////////////////////////////////////// // ///////////////////////////////////////////////BEGIN GET MAPPINGS///////////////////////////////////////////////////
/** /**
* * Gets all stored teams from the database
* @return * @return a HttpStatus.NOT_FOUND ResponseEntity if the database does not contain any teams,
* else a ResponseEntity containing the list of all Teams in WSTO form
*/ */
@GetMapping("all") @GetMapping("all")
public ResponseEntity<@NonNull List<TeamWSTO>> getAllTeams(){ public ResponseEntity<@NonNull List<TeamWSTO>> getAllTeams(){
@@ -62,6 +63,11 @@ public class TeamRestController {
return new ResponseEntity<>(teamWSTOs, HttpStatus.OK); return new ResponseEntity<>(teamWSTOs, HttpStatus.OK);
} }
/**
* Gets all the information pertaining to a given team via the API
* @param reqTeam the team to query all information about with either a name or an id field set
* @return a ResponseEntity containing the team in WSTO form, or a ResponseEntity containing either BAD_REQUEST or NOT_FOUND.
*/
@GetMapping("single-team") @GetMapping("single-team")
public ResponseEntity<@NonNull TeamWSTO> getSingleTeam(@RequestBody Team reqTeam){ public ResponseEntity<@NonNull TeamWSTO> getSingleTeam(@RequestBody Team reqTeam){
UUID id = reqTeam.getId(); UUID id = reqTeam.getId();
@@ -84,14 +90,24 @@ public class TeamRestController {
} }
} }
///////////////////////////////////////////////////BEGIN DELETE MAPPINGS/////////////////////////////////////////////////// // ///////////////////////////////////////////////BEGIN DELETE MAPPINGS///////////////////////////////////////////////////
/**
* Deletes all teams (yes, really)
* @return a ResponseEntity with HttpStatus.OK
*/
@DeleteMapping("all") @DeleteMapping("all")
public ResponseEntity< @NonNull String> deleteAllTeams(){ public ResponseEntity< @NonNull String> deleteAllTeams(){
teamService.deleteAllTeams(); teamService.deleteAllTeams();
return ResponseEntity.of(ProblemDetail.forStatusAndDetail(HttpStatus.OK,"All teams deleted")).build(); return ResponseEntity.of(ProblemDetail.forStatusAndDetail(HttpStatus.OK,"All teams deleted")).build();
} }
/**
* Deletes a team via its name or id
* @param team the team to query all information about with either a name or an id field set
* @return a ResponseEntity containing HttpStatus.OK if deletion was successful,
* or a ResponseEntity containing either BAD_REQUEST or NOT_FOUND.
*/
@DeleteMapping("single-team") @DeleteMapping("single-team")
public ResponseEntity<@NonNull String> deleteTeam(@RequestBody Team team){ public ResponseEntity<@NonNull String> deleteTeam(@RequestBody Team team){
String name = team.getTeamName(); String name = team.getTeamName();
@@ -108,6 +124,5 @@ public class TeamRestController {
else return ResponseEntity.of(ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, "Team could not be found")).build(); else return ResponseEntity.of(ProblemDetail.forStatusAndDetail(HttpStatus.NOT_FOUND, "Team could not be found")).build();
} }
} }
} }