-
Notifications
You must be signed in to change notification settings - Fork 2
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
2 changed files
with
45 additions
and
3 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
41 changes: 41 additions & 0 deletions
41
backend/emm-sale/src/main/java/com/emmsale/member/application/dto/MemberDetailResponse.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,41 @@ | ||
package com.emmsale.member.application.dto; | ||
|
||
import static java.util.stream.Collectors.toUnmodifiableList; | ||
|
||
import com.emmsale.member.domain.Member; | ||
import com.emmsale.member.domain.MemberActivity; | ||
import java.util.List; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public class MemberDetailResponse { | ||
|
||
private static final String GITHUB_URL_PREFIX = "https://github.com/"; | ||
|
||
private final Long id; | ||
private final String name; | ||
private final String description; | ||
private final String imageUrl; | ||
private final String githubUrl; | ||
private final List<MemberActivityResponse> activities; | ||
|
||
public static MemberDetailResponse from( | ||
final Member member, | ||
final List<MemberActivity> activities | ||
) { | ||
final List<MemberActivityResponse> memberActivityResponses = activities.stream() | ||
.map(MemberActivityResponse::from) | ||
.collect(toUnmodifiableList()); | ||
|
||
return new MemberDetailResponse( | ||
member.getId(), | ||
member.getName(), | ||
member.getDescription(), | ||
member.getImageUrl(), | ||
GITHUB_URL_PREFIX + member.getGithubUsername(), | ||
memberActivityResponses | ||
); | ||
} | ||
} |