Skip to content

Commit

Permalink
Docs: 회원 탈퇴 api 문서 (#73)
Browse files Browse the repository at this point in the history
* Docs: 회원 탈퇴 docs 추가

* Comment: 챌린지 구현 완료 후 사용자 챌린지 삭제 todo 주석 추가

- revoke 메서드 설명 추가

* Fix: pr 수정
  • Loading branch information
hee9841 authored Aug 12, 2024
1 parent 1f2c557 commit a00832b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ private SocialProfile createMember(String oauthId, String email, SocialType soci

private void deleteMember(long memberId) {
badgeAchievementRepository.deleteByMemberId(memberId);
// todo 챌린지 삭제(챌린지 기능 구현 완료 후)
runningRecordRepository.deleteByMemberId(memberId);
memberLevelRepository.deleteByMemberId(memberId);
socialProfileRepository.deleteByMemberId(memberId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface OidcProvider {
String getAccessToken(String code);

/**
*
* 소셜로그인 연결 해제
* @param accessToken 엑세스토큰
*/
void revoke(String accessToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
import com.dnd.runus.presentation.v1.oauth.dto.request.WithdrawRequest;
import com.dnd.runus.presentation.v1.oauth.dto.response.TokenResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "OAuth")
@RequestMapping("/api/v1/auth/oauth")
@RestController
@RequiredArgsConstructor
Expand All @@ -29,11 +33,26 @@ public class OauthController {
@ApiErrorType({ErrorType.UNSUPPORTED_SOCIAL_TYPE, ErrorType.MALFORMED_ACCESS_TOKEN, ErrorType.UNSUPPORTED_JWT_TOKEN
})
@PostMapping
@ResponseStatus(HttpStatus.OK)
public TokenResponse signIn(@Valid @RequestBody OauthRequest request) {
return oauthService.signIn(request);
}

@Operation(
summary = "회원 탈퇴",
description =
"""
## 회원 탈퇴 API입니다.
idToken과 authorizationCode로 애플에서 토큰을 발급합니다.<br>
발급 받은 토큰으로 사용자의 서비스 해제 요청을 합니다.<br>
사용자의 모든 데이터를 삭제합니다.
""")
@ApiErrorType({
ErrorType.UNSUPPORTED_SOCIAL_TYPE,
ErrorType.FAILED_AUTHENTICATION,
})
@PostMapping("/withdraw")
@ResponseStatus(HttpStatus.OK)
public void withdraw(@MemberId long memberId, @Valid @RequestBody WithdrawRequest request) {
oauthService.withdraw(memberId, request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public record WithdrawRequest(
@Schema(description = "소셜 로그인 타입")
@NotNull
SocialType socialType,
@Schema(description = "authorizationCode")
@NotBlank
String authorizationCode,
@NotBlank
Expand Down

0 comments on commit a00832b

Please sign in to comment.