Skip to content

Commit

Permalink
#52 [feat] : 서비스 약관 동의 여부 조회 API 구현 (GET)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbang105 committed Jun 7, 2024
1 parent 1313dc9 commit 2bec130
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,13 @@ public ResponseEntity<ApiResponse<Object>> addUserAgreement(
userService.addUserAgreement(authorizationHeader);
return ApiResponse.onSuccess(SuccessStatus.SUCCESS_ADD_AGREEMENT);
}

// 서비스 약관 동의 여부 조회 API
@GetMapping("/agreement")
public ResponseEntity<ApiResponse<UserDto.getUserAgreementResponse>> getUserAgreement(
@RequestHeader("Authorization") String authorizationHeader) {

UserDto.getUserAgreementResponse getUserAgreementResponse = userService.getUserAgreement(authorizationHeader);
return ApiResponse.onSuccess(SuccessStatus.SUCCESS_GET_AGREEMENT, getUserAgreementResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
public interface UserService {
void addUserUpbitKeys(String authorizationHeader, UserDto.UserUpbitKeyRequest userUpbitKeyRequest);
void addUserAgreement(String authorizationHeader);
UserDto.getUserAgreementResponse getUserAgreement(String authorizationHeader);
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public void addUserAgreement(String authorizationHeader) {
user.updateAgreement();
}

// 서비스 약관 동의 여부를 조회하는 메서드
@Override
public UserDto.getUserAgreementResponse getUserAgreement(String authorizationHeader) {
User user = jwtUtil.getUserFromHeader(authorizationHeader);
return UserDto.getUserAgreementResponse.of(user);
}

// 암호화 및 인코딩 메서드
private String encryptAndEncode(String data, KeyPair keyPair) {
byte[] encryptedData = encryptionUtil.encrypt(data.getBytes(), keyPair.getPublic());
Expand Down

0 comments on commit 2bec130

Please sign in to comment.