Skip to content

Commit

Permalink
refactor: map 타겟 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Juhongseok committed Dec 19, 2023
1 parent 6559f57 commit b1b54e4
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

public record MentorEventResponse(EventInfoResponse info, List<ResumeResponse> resumes) {

public MentorEventResponse(Event event, int size, List<Resume> resumes, List<UserResponse> mentees) {
this(new EventInfoResponse(event, size, new ArrayList<>()), toResponse(event, resumes, mentees));
public MentorEventResponse(Event event, int size, List<MenteeToEvent> menteeToEvents, List<Resume> resumes, List<UserResponse> mentees) {
this(new EventInfoResponse(event, size, new ArrayList<>()), toResponse(menteeToEvents, resumes, mentees));
}

public static List<MentorEventResponse> collect(List<MenteeToEvent> menteeToEvents, List<Resume> resumes, List<UserResponse> mentees) {
Expand All @@ -30,11 +30,11 @@ public static List<MentorEventResponse> collect(List<MenteeToEvent> menteeToEven
.toList();

return events.stream()
.map(event -> new MentorEventResponse(event, menteeToEventMap.get(event.getId()).size(), resumes, mentees))
.map(event -> new MentorEventResponse(event, menteeToEventMap.get(event.getId()).size(), menteeToEvents, resumes, mentees))
.toList();
}

public static List<ResumeResponse> toResponse(Event event, List<Resume> resumes, List<UserResponse> mentees) {
public static List<ResumeResponse> toResponse(List<MenteeToEvent> menteeToEvents, List<Resume> resumes, List<UserResponse> mentees) {
if (resumes.isEmpty()) {
return List.of();
}
Expand All @@ -49,7 +49,7 @@ public static List<ResumeResponse> toResponse(Event event, List<Resume> resumes,
.collect(Collectors.toMap(MenteeEvent::resumeId, MenteeEvent::menteeName));


return event.getApplicants().stream()
return menteeToEvents.stream()
.map(applicant -> {
Resume resume = resumesMap.get(applicant.getResumeId());
String menteeName = menteeNames.get(applicant.getResumeId());
Expand Down

0 comments on commit b1b54e4

Please sign in to comment.