update swagger configure
This commit is contained in:
@@ -14,7 +14,14 @@ import com.billpaymentservice.bbps.dto.auth.LoginRequest;
|
||||
import com.billpaymentservice.bbps.dto.auth.RegisterRequest;
|
||||
import com.billpaymentservice.bbps.dto.auth.VerifyOtpRequest;
|
||||
import com.billpaymentservice.bbps.service.AuthService;
|
||||
import com.billpaymentservice.bbps.util.ApiDocCommonResponses;
|
||||
import com.billpaymentservice.bbps.util.BBPSConstant;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@RestController
|
||||
@@ -29,25 +36,42 @@ public class AuthController {
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/sendOtp", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = "/sendOtp")
|
||||
@Operation(summary = "Send OTP to user", description = "This API sends an OTP to the user's registered mobile number for authentication.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = BBPSConstant.OK_STR, description = "OTP sent successfully", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseModel.class))) })
|
||||
@ApiDocCommonResponses
|
||||
public ResponseEntity<ResponseModel> sendOtp(@Validated @RequestBody LoginRequest request) {
|
||||
log.info("Received sendOtp request for mobile: {}", request.getMobile());
|
||||
return ResponseEntity.ok(authService.sendOtp(request));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/verifyOtp", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = "/verifyOtp")
|
||||
@Operation(summary = "Verify OTP", description = "This API verifies the OTP entered by the user and validates the authentication flow.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = BBPSConstant.OK_STR, description = "OTP verified successfully", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseModel.class))) })
|
||||
@ApiDocCommonResponses
|
||||
|
||||
public ResponseEntity<ResponseModel> verifyOtp(@Validated @RequestBody VerifyOtpRequest request) {
|
||||
|
||||
return ResponseEntity.ok(authService.verifyOtp(request));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/register", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = "/register")
|
||||
@Operation(summary = "Register a new user", description = "This API registers a new user into the system by validating the provided registration details.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = BBPSConstant.OK_STR, description = "User registered successfully", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseModel.class))) })
|
||||
@ApiDocCommonResponses
|
||||
public ResponseEntity<ResponseModel> register(@Validated @RequestBody RegisterRequest request) {
|
||||
|
||||
return ResponseEntity.ok(authService.registerUser(request));
|
||||
}
|
||||
|
||||
@PostMapping("/loginWithoutDecryption")
|
||||
@Operation(summary = "Login without decryption (Testing Only)", description = "This API is used only for testing purposes. It authenticates the user without decrypting the credentials, typically used when token generation fails or decryption flow is not enabled.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = BBPSConstant.OK_STR, description = "User authenticated successfully (Testing Only)", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseModel.class))) })
|
||||
@ApiDocCommonResponses
|
||||
public ResponseEntity<ResponseModel> login(@RequestBody LoginRequest loginRequest) {
|
||||
|
||||
return ResponseEntity.ok(authService.authenticateUser(loginRequest));
|
||||
|
||||
Reference in New Issue
Block a user