diff --git a/backend/src/main/java/com/greenfoxacademy/backend/config/ResponseEntityErrorHandler.java b/backend/src/main/java/com/greenfoxacademy/backend/config/ResponseEntityErrorHandler.java index 7c7612b..405da85 100644 --- a/backend/src/main/java/com/greenfoxacademy/backend/config/ResponseEntityErrorHandler.java +++ b/backend/src/main/java/com/greenfoxacademy/backend/config/ResponseEntityErrorHandler.java @@ -1,10 +1,12 @@ package com.greenfoxacademy.backend.config; -import com.greenfoxacademy.backend.errors.*; - +import com.greenfoxacademy.backend.errors.CannotSendEmailException; +import com.greenfoxacademy.backend.errors.CannotUpdateUserException; +import com.greenfoxacademy.backend.errors.CannotVerifyUserError; +import com.greenfoxacademy.backend.errors.UnableToDeleteProfileError; +import com.greenfoxacademy.backend.errors.UserAlreadyExistsError; import java.util.HashMap; import java.util.Map; - import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.FieldError; diff --git a/backend/src/main/java/com/greenfoxacademy/backend/controller/UserController.java b/backend/src/main/java/com/greenfoxacademy/backend/controller/UserController.java index b62bb24..7057c51 100644 --- a/backend/src/main/java/com/greenfoxacademy/backend/controller/UserController.java +++ b/backend/src/main/java/com/greenfoxacademy/backend/controller/UserController.java @@ -59,7 +59,7 @@ public ResponseEntity registerUser( */ @PostMapping("/login") public ResponseEntity loginUser(@RequestBody LoginRequestDto loginRequestDto) - throws UserNotVerifiedException { + throws UserNotVerifiedException { return ResponseEntity.status(HttpStatus.OK).body(userService.login(loginRequestDto)); } diff --git a/backend/src/main/java/com/greenfoxacademy/backend/errors/UserNotVerifiedException.java b/backend/src/main/java/com/greenfoxacademy/backend/errors/UserNotVerifiedException.java new file mode 100644 index 0000000..33eff9f --- /dev/null +++ b/backend/src/main/java/com/greenfoxacademy/backend/errors/UserNotVerifiedException.java @@ -0,0 +1,13 @@ +package com.greenfoxacademy.backend.errors; + +/** + * Error to throw when a user cannot be verified. + *

+ * This error should be thrown when a user cannot be verified. + *

+ */ +public class UserNotVerifiedException extends RuntimeException { + public UserNotVerifiedException(String message) { + super(message); + } +} \ No newline at end of file diff --git a/backend/src/main/java/com/greenfoxacademy/backend/services/user/UserService.java b/backend/src/main/java/com/greenfoxacademy/backend/services/user/UserService.java index d57011a..fa8a535 100644 --- a/backend/src/main/java/com/greenfoxacademy/backend/services/user/UserService.java +++ b/backend/src/main/java/com/greenfoxacademy/backend/services/user/UserService.java @@ -6,7 +6,12 @@ import com.greenfoxacademy.backend.dtos.ProfileUpdateResponseDto; import com.greenfoxacademy.backend.dtos.RegisterRequestDto; import com.greenfoxacademy.backend.dtos.RegisterResponseDto; -import com.greenfoxacademy.backend.errors.*; +import com.greenfoxacademy.backend.errors.CannotSendEmailException; +import com.greenfoxacademy.backend.errors.CannotUpdateUserException; +import com.greenfoxacademy.backend.errors.CannotVerifyUserError; +import com.greenfoxacademy.backend.errors.UnableToDeleteProfileError; +import com.greenfoxacademy.backend.errors.UserAlreadyExistsError; +import com.greenfoxacademy.backend.errors.UserNotVerifiedException; import com.greenfoxacademy.backend.models.User; import java.util.UUID; import org.springframework.security.core.userdetails.UserDetailsService;