From de3d6828af89d9c13ba02a9969a17b2ece939e44 Mon Sep 17 00:00:00 2001 From: mzeong Date: Tue, 14 Jan 2025 17:51:56 +0900 Subject: [PATCH 1/3] =?UTF-8?q?docs:=20=EC=95=A0=ED=94=8C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=ED=9A=8C=EC=9B=90=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?API=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ody/member/controller/MemberController.java | 13 +++++++++++++ .../member/controller/MemberControllerSwagger.java | 11 ++++++++++- .../member/dto/request/MemberDeleteRequestV2.java | 10 ++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 backend/src/main/java/com/ody/member/dto/request/MemberDeleteRequestV2.java diff --git a/backend/src/main/java/com/ody/member/controller/MemberController.java b/backend/src/main/java/com/ody/member/controller/MemberController.java index a42c008ae..397395e34 100644 --- a/backend/src/main/java/com/ody/member/controller/MemberController.java +++ b/backend/src/main/java/com/ody/member/controller/MemberController.java @@ -2,12 +2,15 @@ import com.ody.common.annotation.AuthMember; import com.ody.member.domain.Member; +import com.ody.member.dto.request.MemberDeleteRequestV2; import com.ody.member.service.MemberService; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @Slf4j @@ -24,4 +27,14 @@ public ResponseEntity delete(@AuthMember Member member) { return ResponseEntity.status(HttpStatus.NO_CONTENT) .build(); } + + @Override + @DeleteMapping("/v2/members") + public ResponseEntity deleteV2( + @AuthMember Member member, + @Valid @RequestBody MemberDeleteRequestV2 memberDeleteRequest + ) { + return ResponseEntity.status(HttpStatus.NO_CONTENT) + .build(); + } } diff --git a/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java b/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java index d30dc0b66..45331b033 100644 --- a/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java +++ b/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java @@ -1,6 +1,7 @@ package com.ody.member.controller; import com.ody.member.domain.Member; +import com.ody.member.dto.request.MemberDeleteRequestV2; import com.ody.swagger.annotation.ErrorCode401; import com.ody.swagger.annotation.ErrorCode500; import io.swagger.v3.oas.annotations.Operation; @@ -15,10 +16,18 @@ public interface MemberControllerSwagger { @Operation( - summary = "회원 삭제", + summary = "회원 삭제 (deprecated)", responses = @ApiResponse(responseCode = "204", description = "회원 삭제 성공") ) @ErrorCode401 @ErrorCode500 ResponseEntity delete(@Parameter(hidden = true) Member member); + + @Operation( + summary = "회원 삭제", + responses = @ApiResponse(responseCode = "204", description = "회원 삭제 성공") + ) + @ErrorCode401 + @ErrorCode500 + ResponseEntity deleteV2(@Parameter(hidden = true) Member member, MemberDeleteRequestV2 memberDeleteRequest); } diff --git a/backend/src/main/java/com/ody/member/dto/request/MemberDeleteRequestV2.java b/backend/src/main/java/com/ody/member/dto/request/MemberDeleteRequestV2.java new file mode 100644 index 000000000..009252ec2 --- /dev/null +++ b/backend/src/main/java/com/ody/member/dto/request/MemberDeleteRequestV2.java @@ -0,0 +1,10 @@ +package com.ody.member.dto.request; + +import io.swagger.v3.oas.annotations.media.Schema; + +public record MemberDeleteRequestV2( + @Schema(description = "애플 인증 코드", example = "authorizationcodeauthorizationcode") + String authorizationCode +) { + +} From 47efd816182cad00bd622f85068c9a5d3ac670d4 Mon Sep 17 00:00:00 2001 From: mzeong Date: Tue, 14 Jan 2025 17:53:16 +0900 Subject: [PATCH 2/3] =?UTF-8?q?docs:=20=EC=95=A0=ED=94=8C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=ED=9A=8C=EC=9B=90=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?API=20=EB=AC=B8=EC=84=9C=ED=99=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ody/member/controller/MemberController.java | 8 +------- .../ody/member/controller/MemberControllerSwagger.java | 3 +-- .../ody/member/dto/request/MemberDeleteRequestV2.java | 10 ---------- 3 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 backend/src/main/java/com/ody/member/dto/request/MemberDeleteRequestV2.java diff --git a/backend/src/main/java/com/ody/member/controller/MemberController.java b/backend/src/main/java/com/ody/member/controller/MemberController.java index 397395e34..b237a9268 100644 --- a/backend/src/main/java/com/ody/member/controller/MemberController.java +++ b/backend/src/main/java/com/ody/member/controller/MemberController.java @@ -2,15 +2,12 @@ import com.ody.common.annotation.AuthMember; import com.ody.member.domain.Member; -import com.ody.member.dto.request.MemberDeleteRequestV2; import com.ody.member.service.MemberService; -import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @Slf4j @@ -30,10 +27,7 @@ public ResponseEntity delete(@AuthMember Member member) { @Override @DeleteMapping("/v2/members") - public ResponseEntity deleteV2( - @AuthMember Member member, - @Valid @RequestBody MemberDeleteRequestV2 memberDeleteRequest - ) { + public ResponseEntity deleteV2(@AuthMember Member member) { return ResponseEntity.status(HttpStatus.NO_CONTENT) .build(); } diff --git a/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java b/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java index 45331b033..66a6545e7 100644 --- a/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java +++ b/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java @@ -1,7 +1,6 @@ package com.ody.member.controller; import com.ody.member.domain.Member; -import com.ody.member.dto.request.MemberDeleteRequestV2; import com.ody.swagger.annotation.ErrorCode401; import com.ody.swagger.annotation.ErrorCode500; import io.swagger.v3.oas.annotations.Operation; @@ -29,5 +28,5 @@ public interface MemberControllerSwagger { ) @ErrorCode401 @ErrorCode500 - ResponseEntity deleteV2(@Parameter(hidden = true) Member member, MemberDeleteRequestV2 memberDeleteRequest); + ResponseEntity deleteV2(@Parameter(hidden = true) Member member); } diff --git a/backend/src/main/java/com/ody/member/dto/request/MemberDeleteRequestV2.java b/backend/src/main/java/com/ody/member/dto/request/MemberDeleteRequestV2.java deleted file mode 100644 index 009252ec2..000000000 --- a/backend/src/main/java/com/ody/member/dto/request/MemberDeleteRequestV2.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.ody.member.dto.request; - -import io.swagger.v3.oas.annotations.media.Schema; - -public record MemberDeleteRequestV2( - @Schema(description = "애플 인증 코드", example = "authorizationcodeauthorizationcode") - String authorizationCode -) { - -} From 8400bf0a99d575235b8648fcde71970391551e94 Mon Sep 17 00:00:00 2001 From: mzeong Date: Tue, 14 Jan 2025 18:45:36 +0900 Subject: [PATCH 3/3] =?UTF-8?q?docs:=20=EC=95=A0=ED=94=8C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=ED=9A=8C=EC=9B=90=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?API=20=EC=97=90=EB=9F=AC=20=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MemberControllerSwagger.java | 2 ++ .../ody/swagger/annotation/ErrorCode403.java | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 backend/src/main/java/com/ody/swagger/annotation/ErrorCode403.java diff --git a/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java b/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java index 66a6545e7..849dc6bdb 100644 --- a/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java +++ b/backend/src/main/java/com/ody/member/controller/MemberControllerSwagger.java @@ -2,6 +2,7 @@ import com.ody.member.domain.Member; import com.ody.swagger.annotation.ErrorCode401; +import com.ody.swagger.annotation.ErrorCode403; import com.ody.swagger.annotation.ErrorCode500; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -27,6 +28,7 @@ public interface MemberControllerSwagger { responses = @ApiResponse(responseCode = "204", description = "회원 삭제 성공") ) @ErrorCode401 + @ErrorCode403 @ErrorCode500 ResponseEntity deleteV2(@Parameter(hidden = true) Member member); } diff --git a/backend/src/main/java/com/ody/swagger/annotation/ErrorCode403.java b/backend/src/main/java/com/ody/swagger/annotation/ErrorCode403.java new file mode 100644 index 000000000..d823beae5 --- /dev/null +++ b/backend/src/main/java/com/ody/swagger/annotation/ErrorCode403.java @@ -0,0 +1,24 @@ +package com.ody.swagger.annotation; + +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 java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.core.annotation.AliasFor; +import org.springframework.http.ProblemDetail; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@ApiResponse( + responseCode = "403", + description = "권한 문제로 요청 거절", + content = @Content(schema = @Schema(implementation = ProblemDetail.class)) +) +public @interface ErrorCode403 { + + @AliasFor(annotation = ApiResponse.class, attribute = "description") + String description() default "권한 문제로 요청 거절"; +}