diff --git a/src/main/java/com/dnd/dndtravel/auth/controller/request/AppleWithdrawRequest.java b/src/main/java/com/dnd/dndtravel/auth/controller/request/AppleWithdrawRequest.java index 68b252a..2966afc 100644 --- a/src/main/java/com/dnd/dndtravel/auth/controller/request/AppleWithdrawRequest.java +++ b/src/main/java/com/dnd/dndtravel/auth/controller/request/AppleWithdrawRequest.java @@ -1,5 +1,8 @@ package com.dnd.dndtravel.auth.controller.request; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; @@ -7,8 +10,9 @@ 클라이언트에서 서버로 보내는 요청 */ public record AppleWithdrawRequest( - @NotBlank(message = "인증 코드가 존재하지 않습니다.") - @Size(max = 300, message = "인증 코드 길이를 초과하였습니다.") + @Schema(description = "authorization code", requiredMode = REQUIRED) + @NotBlank(message = "authorization code는 필수 입니다.") + @Size(max = 300, message = "authorization code 형식이 아닙니다.") String authorizationCode ) { } diff --git a/src/main/java/com/dnd/dndtravel/auth/controller/swagger/AuthControllerSwagger.java b/src/main/java/com/dnd/dndtravel/auth/controller/swagger/AuthControllerSwagger.java index db30608..7effdd3 100644 --- a/src/main/java/com/dnd/dndtravel/auth/controller/swagger/AuthControllerSwagger.java +++ b/src/main/java/com/dnd/dndtravel/auth/controller/swagger/AuthControllerSwagger.java @@ -1,5 +1,7 @@ package com.dnd.dndtravel.auth.controller.swagger; +import com.dnd.dndtravel.auth.controller.request.AppleWithdrawRequest; +import com.dnd.dndtravel.config.AuthenticationMember; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -64,4 +66,28 @@ ReissueTokenResponse reissueToken( @Parameter(description = "refreshToken", required = true) ReIssueTokenRequest reissueTokenRequest ); + + @Operation( + summary = "애플 회원 탈퇴 API" + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "정상적으로 탈퇴 되었습니다."), + @ApiResponse(responseCode = "400", description = "인증 실패 또는 유효하지 않은 요청", + content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(example = STATUS_CODE_400_BODY_MESSAGE) + ) + ), + @ApiResponse( + responseCode = "500", description = "서버 오류", + content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(example = "{\"message\":\"Internal Server Error\"}") + ) + ) + }) + void withdraw( + @Parameter(description = "요청 정보(authorization code)", required = true) + AppleWithdrawRequest appleWithdrawRequest, + @Parameter(hidden = true) + AuthenticationMember authenticationMember + ); } diff --git a/src/main/java/com/dnd/dndtravel/config/SwaggerConfig.java b/src/main/java/com/dnd/dndtravel/config/SwaggerConfig.java index 2429906..5ace0a9 100644 --- a/src/main/java/com/dnd/dndtravel/config/SwaggerConfig.java +++ b/src/main/java/com/dnd/dndtravel/config/SwaggerConfig.java @@ -1,7 +1,10 @@ package com.dnd.dndtravel.config; +import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -14,6 +17,26 @@ public OpenAPI openAPI() { .info(new Info() .title("MAPDDANG API") .description("맵땅 앱 관련 API") - .version("1.0.0")); + .version("1.0.0")) + .addSecurityItem(new SecurityRequirement() + .addList("Access Token") + .addList("Refresh Token")) + .components(new Components() + .addSecuritySchemes("Access Token", createAccessTokenScheme()) + .addSecuritySchemes("Refresh Token", createRefreshTokenScheme())); + } + + private SecurityScheme createAccessTokenScheme() { + return new SecurityScheme().type(SecurityScheme.Type.HTTP) + .bearerFormat("JWT") + .scheme("bearer") + .description("Access Token"); + } + + private SecurityScheme createRefreshTokenScheme() { + return new SecurityScheme().type(SecurityScheme.Type.HTTP) + .bearerFormat("JWT") + .scheme("bearer") + .description("Refresh Token"); } }