-
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.
- Loading branch information
Showing
5 changed files
with
127 additions
and
0 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
54 changes: 54 additions & 0 deletions
54
src/main/java/net/teumteum/user/domain/response/FriendsResponse.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,54 @@ | ||
package net.teumteum.user.domain.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.List; | ||
import net.teumteum.user.domain.User; | ||
|
||
public record FriendsResponse( | ||
List<Friend> friends | ||
) { | ||
|
||
public static FriendsResponse of(List<User> users) { | ||
return new FriendsResponse( | ||
users.stream() | ||
.map(Friend::of) | ||
.toList() | ||
); | ||
} | ||
|
||
public record Friend( | ||
Long id, | ||
Long characterId, | ||
String name, | ||
Job job | ||
) { | ||
|
||
public static Friend of(User user) { | ||
return new Friend( | ||
user.getId(), | ||
user.getCharacterId(), | ||
user.getName(), | ||
Job.of(user) | ||
); | ||
} | ||
|
||
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
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