Skip to content

Commit

Permalink
[FEAT] Sign Up API 구현
Browse files Browse the repository at this point in the history
- 회원가입 성공에 대한 Success Code 정의
- Auth - SignUpUsecase 정의
  - SignUpCommand 타입 파라미터 선언
- 정의한 API 구현
  • Loading branch information
yummygyudon committed Jan 7, 2025
1 parent 448e280 commit 6e7f2a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sopt.makers.authentication.usecase.auth.port.in.AuthenticateSocialAccountUsecase;
import sopt.makers.authentication.usecase.auth.port.in.AuthenticateSocialAccountUsecase.AuthenticateTokenInfo;
import sopt.makers.authentication.usecase.auth.port.in.CreatePhoneVerificationUsecase;
import sopt.makers.authentication.usecase.auth.port.in.SignUpUsecase;
import sopt.makers.authentication.usecase.auth.port.in.VerifyPhoneVerificationUsecase;

import org.springframework.http.HttpHeaders;
Expand All @@ -28,6 +29,7 @@ public class AuthApiController implements AuthApi {
private final CreatePhoneVerificationUsecase createVerificationUsecase;
private final VerifyPhoneVerificationUsecase verifyVerificationUsecase;
private final AuthenticateSocialAccountUsecase authenticateSocialAccountUsecase;
private final SignUpUsecase signUpUsecase;
private final CookieUtil cookieUtil;

@Override
Expand Down Expand Up @@ -74,4 +76,11 @@ public ResponseEntity<BaseResponse<?>> authenticateSocialAuthInfoFromApp(
AuthResponse.AuthenticateSocialAuthInfoForApp.of(
tokenInfo.accessToken(), tokenInfo.refreshToken()));
}

@Override
@PostMapping("/signup")
public ResponseEntity<BaseResponse<?>> signUp(AuthRequest.SignUp signUp) {
signUpUsecase.signUp(signUp.toCommand());
return ResponseUtil.success(AuthSuccess.CREATE_SIGN_UP_USER);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum AuthSuccess implements SuccessCode {

// 201
CREATE_PHONE_VERIFICATION(HttpStatus.CREATED, "번호 인증 생성에 성공했습니다."),
CREATE_SIGN_UP_USER(HttpStatus.CREATED, "회원 가입에 성공했습니다."),
;

private final HttpStatus status;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package sopt.makers.authentication.usecase.auth.port.in;

import sopt.makers.authentication.domain.auth.AuthPlatform;

public interface SignUpUsecase {

void signUp(SignUpCommand command);

record SignUpCommand(String name, String phone, String authCode, AuthPlatform authPlatform) {}
}

0 comments on commit 6e7f2a3

Please sign in to comment.