Skip to content
Snippets Groups Projects
Commit 21cbdfb0 authored by Karsch Lukas's avatar Karsch Lukas
Browse files

#45 - final changes to swagger annotations

parent 861a2726
No related branches found
No related tags found
1 merge request!44resolve #45 - error status code added
Pipeline #57571 failed
...@@ -89,19 +89,6 @@ public class GardenController { ...@@ -89,19 +89,6 @@ public class GardenController {
return new ResponseEntity<>(response, HttpStatus.OK); return new ResponseEntity<>(response, HttpStatus.OK);
} }
@GetMapping("/getPlantsNeedingWatering")
@Operation(description = "Get plants needing watering")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved plants needing watering"),
})
public ResponseEntity<String> getPlantsNeedingWatering(
@AuthenticationPrincipal User user
) {
String response = gardenService.notifyAboutPlantsNeedingWatering(user);
return new ResponseEntity<>(response, HttpStatus.OK);
}
@PostMapping("/setNewWateringFrequency") @PostMapping("/setNewWateringFrequency")
@Operation(description = "Set new watering frequency for a plant") @Operation(description = "Set new watering frequency for a plant")
@ApiResponses(value = { @ApiResponses(value = {
......
package hdm.mi.growbros.controllers; package hdm.mi.growbros.controllers;
import hdm.mi.growbros.models.GardenEntry; import hdm.mi.growbros.models.GardenEntry;
import hdm.mi.growbros.models.plant.Plant; import hdm.mi.growbros.models.plant.Plant;
import hdm.mi.growbros.models.user.User; import hdm.mi.growbros.models.user.User;
...@@ -11,7 +10,9 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; ...@@ -11,7 +10,9 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
...@@ -48,11 +49,19 @@ public class GrandmaController { ...@@ -48,11 +49,19 @@ public class GrandmaController {
} }
@GetMapping ("/getPlantsNeedingWatering") @GetMapping ("/getPlantsNeedingWatering")
@Operation(description = "Get plants that need to be watered")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved plants that need to be watered"),
})
public ResponseEntity<List<GardenEntry>> getPlantsNeedingWatring (@AuthenticationPrincipal User user){ public ResponseEntity<List<GardenEntry>> getPlantsNeedingWatring (@AuthenticationPrincipal User user){
return ResponseEntity.ok(grandmaService.getGardenEntriesNeedingWatering(user)); return ResponseEntity.ok(grandmaService.getGardenEntriesNeedingWatering(user));
} }
@GetMapping("/getPlantsReadyToHarvest") @GetMapping("/getPlantsReadyToHarvest")
@Operation(description = "Get plants ready to harvest")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successfully retrieved plants ready to harvest"),
})
public ResponseEntity<List<GardenEntry>> getPlantsReadyToHarvest(@AuthenticationPrincipal User user){ public ResponseEntity<List<GardenEntry>> getPlantsReadyToHarvest(@AuthenticationPrincipal User user){
List<GardenEntry> plantsReadyToHarvest = grandmaService.getPlantsReadyToHarvest(user); List<GardenEntry> plantsReadyToHarvest = grandmaService.getPlantsReadyToHarvest(user);
return ResponseEntity.ok(plantsReadyToHarvest); return ResponseEntity.ok(plantsReadyToHarvest);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment