diff --git a/src/main/java/de/pnreichmuth/timekeep_backend/controllers/TeamRestController.java b/src/main/java/de/pnreichmuth/timekeep_backend/controllers/TeamRestController.java index 4f038b3..b2610ca 100644 --- a/src/main/java/de/pnreichmuth/timekeep_backend/controllers/TeamRestController.java +++ b/src/main/java/de/pnreichmuth/timekeep_backend/controllers/TeamRestController.java @@ -25,7 +25,7 @@ public class TeamRestController { private final TeamService teamService; - ///////////////////////////////////////////////////BEGIN POST MAPPINGS/////////////////////////////////////////////////// + // ///////////////////////////////////////////////BEGIN POST MAPPINGS/////////////////////////////////////////////////// /** * 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/////////////////////////////////////////////////// /** - * - * @return + * Gets all stored teams from the database + * @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") public ResponseEntity<@NonNull List> getAllTeams(){ @@ -62,6 +63,11 @@ public class TeamRestController { 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") public ResponseEntity<@NonNull TeamWSTO> getSingleTeam(@RequestBody Team reqTeam){ 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") public ResponseEntity< @NonNull String> deleteAllTeams(){ teamService.deleteAllTeams(); 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") public ResponseEntity<@NonNull String> deleteTeam(@RequestBody Team team){ 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(); } } - }