From 8e247dc2d65fc73978d316e4c930130d9e5bb54c Mon Sep 17 00:00:00 2001
From: Paul Reichmuth
Date: Thu, 18 Dec 2025 16:09:50 +0100
Subject: [PATCH] fully documented existing endpoints
---
.../controllers/TeamRestController.java | 27 ++++++++++++++-----
1 file changed, 21 insertions(+), 6 deletions(-)
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();
}
}
-
}