diff --git a/src/main/java/com/backend/elearning/domain/auth/AuthenticationController.java b/src/main/java/com/backend/elearning/domain/auth/AuthenticationController.java index c03c8a47..f7993a1a 100644 --- a/src/main/java/com/backend/elearning/domain/auth/AuthenticationController.java +++ b/src/main/java/com/backend/elearning/domain/auth/AuthenticationController.java @@ -3,13 +3,17 @@ import com.backend.elearning.domain.student.StudentVm; import com.backend.elearning.domain.user.UserVm; +import io.swagger.v3.oas.annotations.Operation; +import jakarta.validation.Valid; import org.springframework.data.repository.query.Param; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @RequestMapping(value = "/api/v1/auth") @RestController +@Validated public class AuthenticationController { private final AuthenticationService authenticationService; @@ -18,6 +22,7 @@ public AuthenticationController(AuthenticationService authenticationService) { } @PostMapping("/forgotpassword") + @Operation(method = "POST", summary = "Recover password", description ="Send a request via this API to send an email to recover password" ) public ResponseEntity forgotPassword ( @Param("email") String email ) { @@ -26,8 +31,9 @@ public ResponseEntity forgotPassword ( } @PutMapping("/password") + @Operation(method = "PUT", summary = "Update password", description ="Send a request via this API to update password" ) public ResponseEntity forgotPassword ( - @RequestBody AuthenticationPostVm request + @Valid @RequestBody AuthenticationPostVm request ) { authenticationService.updatePassword(request); return ResponseEntity.noContent().build(); @@ -52,6 +58,7 @@ ResponseEntity outboundAuthenticateForMobile( @PostMapping("/login") + @Operation(method = "POST", summary = "Send request to sign in system", description ="Send a request via this API to login" ) public ResponseEntity login ( @RequestBody AuthenticationPostVm request ) { @@ -61,6 +68,7 @@ public ResponseEntity login ( } @PostMapping("/register") + @Operation(method = "POST", summary = "Send request to create new user", description ="Send a request via this API to create new user" ) public ResponseEntity register ( @RequestBody RegistrationPostVm request ) { @@ -81,6 +89,7 @@ public ResponseEntity verify ( @PostMapping("/resend") + @Operation(method = "POST", summary = "Resend verificationCode to recover password user", description ="Send a request via this API to resend token" ) public ResponseEntity resendVerificationCode(@RequestParam String email) { authenticationService.resendVerificationCode(email); return ResponseEntity.ok("Verification code sent");