Skip to content

Commit

Permalink
Merge pull request #67 from 0702Yoon/main
Browse files Browse the repository at this point in the history
member controller 공통 응답 형태로 변환
  • Loading branch information
0702Yoon authored Aug 13, 2024
2 parents 40502f2 + 8fa6bf1 commit c932832
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface MemberController {

@Operation(summary = "로그인")
@PostMapping("/sign-in")
JwtToken signIn(@RequestBody MemberRequest memberRequest);
ResponseEntity<com.example.bigbrotherbe.global.exception.response.ApiResponse<JwtToken>>signIn(@RequestBody MemberRequest memberRequest);

@PostMapping("/test")
@Operation(summary = "test용", description = "현재는 로그인 멤버의 AffiliationRoleLost를 가져오는 값")
Expand All @@ -51,15 +51,15 @@ public interface MemberController {

@GetMapping("/sign-up/emails/verification")
@Operation(summary = "이메일 중복확인")
ResponseEntity<EmailVerificationResult> verificateEmail(@RequestParam(name = "member-email") String email);
ResponseEntity<com.example.bigbrotherbe.global.exception.response.ApiResponse<EmailVerificationResult>> verificateEmail(@RequestParam(name = "member-email") String email);

@PostMapping("/sign-up/emails/request-code")
@Operation(summary = "이메일 인증 코드 요청")
ResponseEntity<EmailVerificationResult> sendMessage(@RequestBody EmailRequest emailRequest);
ResponseEntity<com.example.bigbrotherbe.global.exception.response.ApiResponse<EmailVerificationResult>> sendMessage(@RequestBody EmailRequest emailRequest);

@GetMapping("/sign-up/emails/verifications")
@Operation(summary = "이메일 인증 코드 검증")
ResponseEntity<EmailVerificationResult> verificationEmail(@RequestParam(name = "email") String email, @RequestParam(name = "code") String code);
ResponseEntity<com.example.bigbrotherbe.global.exception.response.ApiResponse<EmailVerificationResult>> verificationEmail(@RequestParam(name = "email") String email, @RequestParam(name = "code") String code);

@PatchMapping()
@Operation(summary = "비밀번호 변경")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public ResponseEntity<ApiResponse<MemberResponse>> signUp( SignUpDto signUpDto)
return ResponseEntity.ok(ApiResponse.success(SUCCESS, memberResponse));
}

public JwtToken signIn(MemberRequest memberRequest) {
public ResponseEntity<ApiResponse<JwtToken>> signIn(MemberRequest memberRequest) {
String memberEmail = memberRequest.getMemberEmail();
String password = memberRequest.getMemberPass();
// 컨트롤러가 없어도 굴러가게 만들어야 하는 데 그러면 Request 객체를 그대로 넘겨주나?
JwtToken jwtToken = memberService.userSignIN(memberEmail, password);
log.info("request memberEmail = {}, password = {}", memberEmail, password);
log.info("jwtToken accessToken = {}, refreshToken = {}", jwtToken.getAccessToken(),
jwtToken.getRefreshToken());
return jwtToken;
return ResponseEntity.ok(ApiResponse.success(SUCCESS, jwtToken)) ;
}


Expand All @@ -57,18 +57,18 @@ public ResponseEntity<ApiResponse<MemberInfoResponse>> inquireMemberInfo() {
return ResponseEntity.ok(ApiResponse.success(SUCCESS,memberService.inquireMemberInfo()));
}

public ResponseEntity<EmailVerificationResult> verificateEmail(String email) {
return ResponseEntity.ok(memberService.verificateEmail(email));
public ResponseEntity<ApiResponse<EmailVerificationResult>> verificateEmail(String email) {
return ResponseEntity.ok(ApiResponse.success(SUCCESS, memberService.verificateEmail(email))) ;
}

public ResponseEntity<EmailVerificationResult> sendMessage(EmailRequest emailRequest) {
public ResponseEntity<ApiResponse<EmailVerificationResult>> sendMessage(EmailRequest emailRequest) {
memberService.sendCodeToEmail(emailRequest.getEmail());
return ResponseEntity.ok(EmailVerificationResult.builder().authResult(true).build());
return ResponseEntity.ok(ApiResponse.success(SUCCESS,EmailVerificationResult.builder().authResult(true).build()));
}


public ResponseEntity<EmailVerificationResult> verificationEmail(String email, String code) {
return ResponseEntity.ok(memberService.verifiedCode(email, code));
public ResponseEntity<ApiResponse<EmailVerificationResult>> verificationEmail(String email, String code) {
return ResponseEntity.ok(ApiResponse.success(SUCCESS,memberService.verifiedCode(email, code)));
}


Expand Down

0 comments on commit c932832

Please sign in to comment.