Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 내 정보 조회에 Oauth 정보 추가 #119

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,37 @@ public record UserMeGetResponse(
String status,
String goal,
Job job,
String oauthType,
List<String> interests
) {

public static UserMeGetResponse of(User user) {
return new UserMeGetResponse(user.getId(), user.getName(), user.getBirth(), user.getCharacterId(),
user.getMannerTemperature(), user.getOauth().getAuthenticated(), user.getActivityArea(), user.getMbti(),
user.getStatus().name(), user.getGoal(), Job.of(user), user.getInterests());
return new UserMeGetResponse(
user.getId(),
user.getName(),
user.getBirth(),
user.getCharacterId(),
user.getMannerTemperature(),
user.getOauth().getAuthenticated(),
user.getActivityArea(),
user.getMbti(),
user.getStatus().name(),
user.getGoal(),
Job.of(user),
user.getOauth().getAuthenticated().name(),
user.getInterests()
);
}


public record Job(String name, boolean certificated, @JsonProperty("class") String jobClass, String detailClass) {

public static Job of(User user) {
return new Job(user.getJob().getName(), user.getJob().isCertificated(), user.getJob().getJobClass(),
user.getJob().getDetailJobClass());
return new Job(
user.getJob().getName(),
user.getJob().isCertificated(),
user.getJob().getJobClass(),
user.getJob().getDetailJobClass()
);
}
}
}
8 changes: 8 additions & 0 deletions src/test/java/net/teumteum/integration/Api.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ ResponseSpec getUser(String token, Long userId) {
.exchange();
}

ResponseSpec getMe(String token) {
return webTestClient
.get()
.uri("/users/me")
.header(HttpHeaders.AUTHORIZATION, token)
.exchange();
}

ResponseSpec getUsersById(String token, String userIds) {
return webTestClient.get()
.uri("/users?id=" + userIds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void Return_my_info_if_valid_token_received() {
var expected = UserMeGetResponse.of(me);

// when
var result = api.getUser(VALID_TOKEN, me.getId());
var result = api.getMe(VALID_TOKEN);

// then
Assertions.assertThat(result.expectStatus().isOk()
Expand Down
Loading