-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 유저 id들로 유저를 조회하는 API를 개발한다 * test: UUID에 해당하는 검증을 제외한다
- Loading branch information
Showing
9 changed files
with
181 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/java/net/teumteum/user/domain/response/UsersGetByIdResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package net.teumteum.user.domain.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.List; | ||
import net.teumteum.user.domain.User; | ||
|
||
public record UsersGetByIdResponse( | ||
List<UserGetResponse> users | ||
) { | ||
|
||
public static UsersGetByIdResponse of(List<User> users) { | ||
return new UsersGetByIdResponse(users.stream() | ||
.map(UserGetResponse::of) | ||
.toList()); | ||
} | ||
|
||
|
||
public record UserGetResponse( | ||
Long id, | ||
String name, | ||
String birth, | ||
Long characterId, | ||
int mannerTemperature, | ||
String authenticated, | ||
ActivityArea activityArea, | ||
String mbti, | ||
String status, | ||
String goal, | ||
Job job, | ||
List<String> interests | ||
) { | ||
|
||
public static UserGetResponse of(User user) { | ||
return new UserGetResponse( | ||
user.getId(), | ||
user.getName(), | ||
user.getBirth(), | ||
user.getCharacterId(), | ||
user.getMannerTemperature(), | ||
user.getOauth().getAuthenticated(), | ||
ActivityArea.of(user), | ||
user.getMbti(), | ||
user.getStatus().name(), | ||
user.getGoal(), | ||
Job.of(user), | ||
user.getInterests() | ||
); | ||
} | ||
|
||
public record ActivityArea( | ||
String city, | ||
List<String> streets | ||
) { | ||
|
||
public static ActivityArea of(User user) { | ||
return new ActivityArea( | ||
user.getActivityArea().getCity(), | ||
user.getActivityArea().getStreet() | ||
); | ||
} | ||
|
||
} | ||
|
||
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() | ||
); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package net.teumteum.user.domain; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
import lombok.Builder; | ||
|
||
public class UserFixture { | ||
|
@@ -53,7 +54,7 @@ public static class UserBuilder { | |
@Builder.Default | ||
private int mannerTemperature = 36; | ||
@Builder.Default | ||
private Oauth oauth = new Oauth("[email protected]", "naver"); | ||
private Oauth oauth = new Oauth(UUID.randomUUID().toString(), "naver"); | ||
@Builder.Default | ||
private ActivityArea activityArea = new ActivityArea("서울", List.of("강남", "홍대")); | ||
@Builder.Default | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters