From 3b7f7ef916bfcaa501dc7cea75305c0f4b866479 Mon Sep 17 00:00:00 2001 From: ddingmin Date: Thu, 18 Jan 2024 23:57:16 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EB=82=B4=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EC=97=90=20Oauth=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/response/UserMeGetResponse.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/teumteum/user/domain/response/UserMeGetResponse.java b/src/main/java/net/teumteum/user/domain/response/UserMeGetResponse.java index 99d827ef..d9ea035b 100644 --- a/src/main/java/net/teumteum/user/domain/response/UserMeGetResponse.java +++ b/src/main/java/net/teumteum/user/domain/response/UserMeGetResponse.java @@ -18,21 +18,37 @@ public record UserMeGetResponse( String status, String goal, Job job, + String oauthType, List 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() + ); } } } From fdb52478de7de79a3b1e98628bdaa329b856312b Mon Sep 17 00:00:00 2001 From: ddingmin Date: Thu, 18 Jan 2024 23:59:15 +0900 Subject: [PATCH 2/2] =?UTF-8?q?test:=20Oauth=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=EC=97=90=20=EB=94=B0=EB=A5=B8=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/net/teumteum/integration/Api.java | 8 ++++++++ .../net/teumteum/integration/UserIntegrationTest.java | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test/java/net/teumteum/integration/Api.java b/src/test/java/net/teumteum/integration/Api.java index 1d6f66e8..05d2945b 100644 --- a/src/test/java/net/teumteum/integration/Api.java +++ b/src/test/java/net/teumteum/integration/Api.java @@ -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) diff --git a/src/test/java/net/teumteum/integration/UserIntegrationTest.java b/src/test/java/net/teumteum/integration/UserIntegrationTest.java index b44f31e9..33c69d8d 100644 --- a/src/test/java/net/teumteum/integration/UserIntegrationTest.java +++ b/src/test/java/net/teumteum/integration/UserIntegrationTest.java @@ -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()