diff --git a/pom.xml b/pom.xml index 80b085177fa433d331332ae2d0eabe16cc040e82..9a8405f1b42dcca74ecdf0f3ff12b90aec586081 100644 --- a/pom.xml +++ b/pom.xml @@ -80,6 +80,16 @@ <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.2.0</version> </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger2</artifactId> + <version>3.0.0</version> + </dependency> + <dependency> + <groupId>io.springfox</groupId> + <artifactId>springfox-swagger-ui</artifactId> + <version>3.0.0</version> + </dependency> </dependencies> <build> diff --git a/src/main/java/hdm/mi/growbros/auth/AuthenticationResponse.java b/src/main/java/hdm/mi/growbros/auth/AuthenticationResponse.java index e0f15556c84bdd62ffca43047038c289f3099c09..51786bf2e31aa563eaeb532c6a21085f510859f8 100644 --- a/src/main/java/hdm/mi/growbros/auth/AuthenticationResponse.java +++ b/src/main/java/hdm/mi/growbros/auth/AuthenticationResponse.java @@ -11,6 +11,5 @@ import lombok.NoArgsConstructor; @NoArgsConstructor public class AuthenticationResponse { private String token; - private String error; private String message; } diff --git a/src/main/java/hdm/mi/growbros/auth/AuthenticationService.java b/src/main/java/hdm/mi/growbros/auth/AuthenticationService.java index 8aef84e0aaeceb9062505249061f671cfc0576d0..42e92e71fa9b8873973a3a60be63f93dde923ae3 100644 --- a/src/main/java/hdm/mi/growbros/auth/AuthenticationService.java +++ b/src/main/java/hdm/mi/growbros/auth/AuthenticationService.java @@ -1,17 +1,18 @@ package hdm.mi.growbros.auth; -import hdm.mi.growbros.exceptions.*; +import hdm.mi.growbros.exceptions.EmailAlreadyExistsException; +import hdm.mi.growbros.exceptions.InvalidDataException; +import hdm.mi.growbros.exceptions.InvalidEmailException; +import hdm.mi.growbros.exceptions.UserNotFoundException; import hdm.mi.growbros.models.user.Role; import hdm.mi.growbros.models.user.User; import hdm.mi.growbros.repositories.UserRepository; import hdm.mi.growbros.security.JwtService; import lombok.RequiredArgsConstructor; import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.http.HttpStatus; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; @@ -60,7 +61,7 @@ public class AuthenticationService { .token(jwtToken) .build(); } catch (DataIntegrityViolationException e) { - throw new EmailAlreadyExistsException(HttpStatus.BAD_REQUEST, "Email ist bereits registriert."); + throw new EmailAlreadyExistsException("Email ist bereits registriert."); } } diff --git a/src/main/java/hdm/mi/growbros/controllers/AuthenticationController.java b/src/main/java/hdm/mi/growbros/controllers/AuthenticationController.java index 9684e861dfab17106a7f31be44ddc4e686fc44fe..3e31cc8eeb5ec594538095246f1b29095af48e2b 100644 --- a/src/main/java/hdm/mi/growbros/controllers/AuthenticationController.java +++ b/src/main/java/hdm/mi/growbros/controllers/AuthenticationController.java @@ -4,12 +4,13 @@ import hdm.mi.growbros.auth.AuthenticationRequest; import hdm.mi.growbros.auth.AuthenticationResponse; import hdm.mi.growbros.auth.AuthenticationService; import hdm.mi.growbros.auth.RegisterRequest; -import hdm.mi.growbros.exceptions.EmailAlreadyExistsException; -import hdm.mi.growbros.exceptions.GrowBrosException; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatusCode; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.ErrorResponse; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -20,17 +21,31 @@ import org.springframework.web.bind.annotation.RestController; @RequiredArgsConstructor public class AuthenticationController { private final AuthenticationService authenticationService; + @PostMapping("/register") + @Operation(description = "Register a new user") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully registered"), + @ApiResponse(responseCode = "400", description = "Invalid data", content = @Content(mediaType = "text/plain")), + @ApiResponse(responseCode = "409", description = "Email already exists", content = @Content(mediaType = "text/plain")) + }) public ResponseEntity<AuthenticationResponse> register( - @RequestBody RegisterRequest request + @RequestBody RegisterRequest request ) { - return ResponseEntity.ok(authenticationService.register(request)); + AuthenticationResponse response = authenticationService.register(request); + return new ResponseEntity<>(response, HttpStatus.OK); } @PostMapping("/authenticate") + @Operation(description = "Authenticate user") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully authenticated"), + @ApiResponse(responseCode = "401", description = "Unauthorized (wrong credentials)", content = @Content(mediaType = "text/plain")) + }) public ResponseEntity<AuthenticationResponse> authenticate( @RequestBody AuthenticationRequest request ) { - return ResponseEntity.ok(authenticationService.authenticate(request)); + AuthenticationResponse response = authenticationService.authenticate(request); + return new ResponseEntity<>(response, HttpStatus.OK); } } diff --git a/src/main/java/hdm/mi/growbros/controllers/GardenController.java b/src/main/java/hdm/mi/growbros/controllers/GardenController.java index 3feeca0a359695c02e9ca7764d166d01ba2c0851..8374bb81fe2628a64971f81d2bebd188efdf09c1 100644 --- a/src/main/java/hdm/mi/growbros/controllers/GardenController.java +++ b/src/main/java/hdm/mi/growbros/controllers/GardenController.java @@ -4,9 +4,14 @@ import hdm.mi.growbros.models.GardenEntry; import hdm.mi.growbros.models.plant.Plant; import hdm.mi.growbros.models.user.User; import hdm.mi.growbros.service.GardenService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import lombok.RequiredArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; @@ -22,6 +27,10 @@ public class GardenController { private final GardenService gardenService; @GetMapping + @Operation(description = "Get plants in the garden") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved plants") + }) public ResponseEntity<List<Plant>> getPlantsInGarden( @RequestParam(value = "sort", required = false) String sort, @AuthenticationPrincipal User user @@ -30,13 +39,23 @@ public class GardenController { } @GetMapping("/count") - public int getGardenSize( + @Operation(description = "Get the size of the garden") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved garden size"), + }) + public ResponseEntity<Integer> getGardenSize( @AuthenticationPrincipal User user ) { - return gardenService.countByUser(user); + Integer response = gardenService.countByUser(user); + return new ResponseEntity<>(response, HttpStatus.OK); } @PostMapping("/add/{plantId}") + @Operation(description = "Add a plant to the garden") + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Successfully added plant to the garden"), + @ApiResponse(responseCode = "404", description = "Plant not found", content = @Content(mediaType = "text/plain")), + }) public ResponseEntity<Plant> addPlantToGarden( @PathVariable Long plantId, @AuthenticationPrincipal User user @@ -46,6 +65,10 @@ public class GardenController { } @DeleteMapping("/remove/{plantId}") + @Operation(description = "Remove a plant from the garden") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Successfully removed plant from the garden"), + }) public ResponseEntity<Void> removePlantFromGarden( @PathVariable Long plantId, @AuthenticationPrincipal User user @@ -55,16 +78,26 @@ public class GardenController { } @DeleteMapping("/remove/all") - public int removeAllPlantsFromGarden( + @Operation(description = "Remove all plants from the garden") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully removed all plants from the garden"), + }) + public ResponseEntity<Integer> removeAllPlantsFromGarden( @AuthenticationPrincipal User user ) { - return gardenService.clearGarden(user); + Integer response = gardenService.clearGarden(user); + return new ResponseEntity<>(response, HttpStatus.OK); } + @PostMapping("/setNewWateringFrequency") - public void setNewWateringService(@RequestParam("wateringFrequency") int wateringFrequency , @RequestBody GardenEntry gardenEntry){ + @Operation(description = "Set new watering frequency for a plant") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Successfully set new watering frequency"), + }) + public ResponseEntity<Void> setNewWateringService( + @RequestParam("wateringFrequency") int wateringFrequency, @RequestBody GardenEntry gardenEntry + ) { gardenEntry.setWateringFrequency(wateringFrequency); + return ResponseEntity.ok(null); } - - - } diff --git a/src/main/java/hdm/mi/growbros/controllers/GrandmaController.java b/src/main/java/hdm/mi/growbros/controllers/GrandmaController.java index f1141a36efaccc5e02ab257d4377cd3f815216af..6041272bc24df8c0fc22602ec51f3aa195df4d3c 100644 --- a/src/main/java/hdm/mi/growbros/controllers/GrandmaController.java +++ b/src/main/java/hdm/mi/growbros/controllers/GrandmaController.java @@ -1,13 +1,18 @@ package hdm.mi.growbros.controllers; - import hdm.mi.growbros.models.GardenEntry; import hdm.mi.growbros.models.plant.Plant; import hdm.mi.growbros.models.user.User; import hdm.mi.growbros.service.GrandmaService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; 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; @@ -17,24 +22,46 @@ public class GrandmaController { private final GrandmaService grandmaService; - public GrandmaController(GrandmaService grandmaService){ + public GrandmaController(GrandmaService grandmaService) { this.grandmaService = grandmaService; } - @GetMapping ("/getGrowingTips") - public ResponseEntity<String> getGrowingTipDesTages(@AuthenticationPrincipal User user) { - return ResponseEntity.ok(grandmaService.growingTippDesTages(user)); + @GetMapping("/getGrowingTips") + @Operation(description = "Get growing tip of the day") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved growing tip"), + }) + public ResponseEntity<String> getGrowingTipDesTages( + @AuthenticationPrincipal User user + ) { + String response = grandmaService.growingTippDesTages(user); + return new ResponseEntity<>(response, HttpStatus.OK); } + @GetMapping ("/getGrowablePlants") + @Operation(description = "Get plants ready to grow") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved plants ready to grow"), + }) public ResponseEntity<List<Plant>> getPlantsReadyToGrow(@AuthenticationPrincipal User user){ return ResponseEntity.ok(grandmaService.getPlantsReadyToGrow(user)); } + @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){ return ResponseEntity.ok(grandmaService.getGardenEntriesNeedingWatering(user)); } + @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){ List<GardenEntry> plantsReadyToHarvest = grandmaService.getPlantsReadyToHarvest(user); return ResponseEntity.ok(plantsReadyToHarvest); diff --git a/src/main/java/hdm/mi/growbros/controllers/PlantsController.java b/src/main/java/hdm/mi/growbros/controllers/PlantsController.java index 97e0554fd38f9d723e246e14dc4eaff58a429047..865a362ae15449f89ee4f799752c09302dd098d1 100644 --- a/src/main/java/hdm/mi/growbros/controllers/PlantsController.java +++ b/src/main/java/hdm/mi/growbros/controllers/PlantsController.java @@ -7,8 +7,14 @@ import hdm.mi.growbros.models.dto.PlantUpdateRequest; import hdm.mi.growbros.models.plant.Plant; import hdm.mi.growbros.models.search.SearchRequest; import hdm.mi.growbros.service.PlantsService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.Collection; @@ -21,40 +27,93 @@ public class PlantsController { private final PlantsService plantsService; @GetMapping - public CustomPageDto<Plant> getAllPlants( + @Operation(description = "Get all plants") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved plants"), + }) + public ResponseEntity<CustomPageDto<Plant>> getAllPlants( @RequestParam(value = "page", defaultValue = "0") int page, @RequestParam(value = "pageSize", defaultValue = "25") int pageSize ) { - return plantsService.getPlants(page, pageSize); + CustomPageDto<Plant> response = plantsService.getPlants(page,pageSize); + return new ResponseEntity<>(response, HttpStatus.OK); } @GetMapping("/{id}") - public Plant getPlant(@PathVariable long id) { - return plantsService.findById(id).orElseThrow(() -> new PlantNotFoundException(id)); + @Operation(description = "Get a specific plant by ID") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved the plant"), + @ApiResponse(responseCode = "404", description = "Plant not found", content = @Content(mediaType = "text/plain")), + }) + public ResponseEntity<Plant> getPlant( + @PathVariable long id + ) { + Plant response = plantsService.findById(id).orElseThrow(() -> new PlantNotFoundException(id)); + return new ResponseEntity<>(response, HttpStatus.OK); } @GetMapping("/randomPlants/{numberOfPlants}") - public Collection<Plant> getRandomPlants(@PathVariable Integer numberOfPlants) { - return plantsService.getRandomPlants(numberOfPlants); + @Operation(description = "Get a collection of random plants") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved random plants"), + }) + public ResponseEntity<Collection<Plant>> getRandomPlants( + @PathVariable Integer numberOfPlants + ) { + Collection<Plant> response = plantsService.getRandomPlants(numberOfPlants); + return new ResponseEntity<>(response, HttpStatus.OK); } @GetMapping("/search") - public Collection<Plant> getPlantsSearchedFor(@Valid SearchRequest searchRequest) { - return plantsService.getPlantsSearchedFor(searchRequest); + @Operation(description = "Search for plants") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved searched plants") + }) + public ResponseEntity<Collection<Plant>> getPlantsSearchedFor( + @Valid SearchRequest searchRequest + ) { + Collection<Plant> response = plantsService.getPlantsSearchedFor(searchRequest); + return new ResponseEntity<>(response, HttpStatus.OK); } @PostMapping - public void createPlant(@RequestBody @Valid Plant plant) { + @Operation(description = "Create a new plant") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Successfully created the plant"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "text/plain")), +}) + public ResponseEntity<Void> createPlant( + @RequestBody @Valid Plant plant + ) { plantsService.createPlant(plant); + return ResponseEntity.ok(null); } @DeleteMapping("/{id}") - public DeletedPlantDto deletePlant(@PathVariable long id) { - return plantsService.deletePlant(id); + @Operation(description = "Delete a plant by ID") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully deleted the plant"), + @ApiResponse(responseCode = "404", description = "Plant not found", content = @Content(mediaType = "text/plain")), + }) + public ResponseEntity<DeletedPlantDto> deletePlant( + @PathVariable long id + ) { + DeletedPlantDto response = plantsService.deletePlant(id); + return new ResponseEntity<>(response, HttpStatus.OK); } @PatchMapping("/{id}") - public Plant updatePlant(@PathVariable long id, @RequestBody PlantUpdateRequest updateRequest) { - return plantsService.updatePlant(id, updateRequest); + @Operation(description = "Update a plant by ID") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully updated the plant"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "text/plain")), + @ApiResponse(responseCode = "404", description = "Plant not found", content = @Content(mediaType = "text/plain")), + }) + public ResponseEntity<Plant> updatePlant( + @PathVariable long id, + @RequestBody PlantUpdateRequest updateRequest + ) { + Plant response = plantsService.updatePlant(id, updateRequest); + return new ResponseEntity<>(response, HttpStatus.OK); } } diff --git a/src/main/java/hdm/mi/growbros/controllers/RestErrorHandler.java b/src/main/java/hdm/mi/growbros/controllers/RestErrorHandler.java index 3098d48ca1bbf803da228d3f39231ce8358ac16d..4fcd1f2ff6683f004a564245ed327ecee1ef3f87 100644 --- a/src/main/java/hdm/mi/growbros/controllers/RestErrorHandler.java +++ b/src/main/java/hdm/mi/growbros/controllers/RestErrorHandler.java @@ -25,6 +25,7 @@ public class RestErrorHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(AccessDeniedException.class) protected ResponseEntity<String> handleAccessDeniedException() { + log.warn("handling access denied exception"); return ResponseEntity.status(401).body("Access denied: role not sufficient"); } diff --git a/src/main/java/hdm/mi/growbros/controllers/WishListController.java b/src/main/java/hdm/mi/growbros/controllers/WishListController.java index 54b9c78475d0750481ad927c28e8ba4d8fef30ca..b9a5f05a1c1a926eda60f28eaed1a5a8ab730d44 100644 --- a/src/main/java/hdm/mi/growbros/controllers/WishListController.java +++ b/src/main/java/hdm/mi/growbros/controllers/WishListController.java @@ -3,6 +3,10 @@ package hdm.mi.growbros.controllers; import hdm.mi.growbros.models.plant.Plant; import hdm.mi.growbros.models.user.User; import hdm.mi.growbros.service.WishListService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -20,34 +24,67 @@ public class WishListController { private final WishListService wishListService; @GetMapping - public Collection<Plant> getAllPlantsInWishList(@RequestParam(value = "sort", required = false) String sort, - @AuthenticationPrincipal User user) { - return wishListService.getWishedPlants(user, sort); + @Operation(description = "Get all plants in wishlist") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved wishlist plants"), + }) + public ResponseEntity<Collection<Plant>> getAllPlantsInWishList( + @RequestParam(value = "sort", required = false) String sort, + @AuthenticationPrincipal User user + ) { + Collection<Plant> response = wishListService.getWishedPlants(user, sort); + return new ResponseEntity<>(response, HttpStatus.OK); } @GetMapping("/count") - public int getWishListSize( - @AuthenticationPrincipal User user) { - return wishListService.countByUser(user); + @Operation(description = "Get the size of the wishlist") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully retrieved wishlist size"), + }) + public ResponseEntity<Integer> getWishListSize( + @AuthenticationPrincipal User user + ) { + Integer response = wishListService.countByUser(user); + return new ResponseEntity<>(response, HttpStatus.OK); } - @PostMapping("/add/{plantId}") - public ResponseEntity<Integer> addPlantToWishlist(@PathVariable Long plantId, - @AuthenticationPrincipal User user) { + @Operation(description = "Add plant to wishlist") + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Successfully added to wishlist"), + @ApiResponse(responseCode = "404", description = "Plant not found", content = @Content(mediaType = "text/plain")), + }) + public ResponseEntity<Void> addPlantToWishlist( + @PathVariable Long plantId, + @AuthenticationPrincipal User user + ) { wishListService.addPlantToWishList(plantId, user); return ResponseEntity.status(201).build(); } @DeleteMapping("/remove/{plantId}") - @ResponseStatus(HttpStatus.NO_CONTENT) - public void removePlantFromWishlist(@PathVariable Long plantId, - @AuthenticationPrincipal User user) { + @Operation(description = "Remove plant from wishlist") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Successfully removed from wishlist"), + @ApiResponse(responseCode = "404", description = "Wishlist entry not found", content = @Content(mediaType = "text/plain")), + }) + public ResponseEntity<Void> removePlantFromWishlist( + @PathVariable Long plantId, + @AuthenticationPrincipal User user + ) { wishListService.removeFromWishList(plantId, user); + return ResponseEntity.ok(null); } @DeleteMapping("/remove/all") - public int removeAllPlantsFromWishlist(@AuthenticationPrincipal User user) { - return wishListService.clearWishList(user); + @Operation(description = "Remove all plants from wishlist") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Successfully removed all from wishlist"), + }) + public ResponseEntity<Integer> removeAllPlantsFromWishlist( + @AuthenticationPrincipal User user + ) { + Integer response = wishListService.clearWishList(user); + return new ResponseEntity<>(response, HttpStatus.OK); } -} \ No newline at end of file +} diff --git a/src/main/java/hdm/mi/growbros/exceptions/EmailAlreadyExistsException.java b/src/main/java/hdm/mi/growbros/exceptions/EmailAlreadyExistsException.java index 800fc13cb0d6bd37235e348481ef21b4caeff278..227eda786c03eafa6070a236db16c43b2a6a4751 100644 --- a/src/main/java/hdm/mi/growbros/exceptions/EmailAlreadyExistsException.java +++ b/src/main/java/hdm/mi/growbros/exceptions/EmailAlreadyExistsException.java @@ -2,8 +2,8 @@ package hdm.mi.growbros.exceptions; import org.springframework.http.HttpStatus; -public class EmailAlreadyExistsException extends GrowBrosException{ - public EmailAlreadyExistsException(HttpStatus httpStatus, String message) { - super(HttpStatus.BAD_REQUEST, message); +public class EmailAlreadyExistsException extends GrowBrosException { + public EmailAlreadyExistsException(String message) { + super(HttpStatus.CONFLICT, message); } }