Skip to content

Commit

Permalink
Merge pull request #63 from onetime-with-members/feature/#62/plus-most
Browse files Browse the repository at this point in the history
[feat] : 유저 참여 이벤트 목록 조회 시 가장 많이 되는 시간 목록도 반환한다
  • Loading branch information
bbbang105 authored Oct 2, 2024
2 parents 7d96142 + 18212ae commit 446253f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/side/onetime/dto/EventDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ public static class GetUserParticipatedEventsResponse {
private String createdDate;
private int participantCount;
private String eventStatus;
private List<GetMostPossibleTime> mostPossibleTimes;

public static GetUserParticipatedEventsResponse of(Event event, EventParticipation eventParticipation, int participantCount) {
public static GetUserParticipatedEventsResponse of(Event event, EventParticipation eventParticipation, int participantCount, List<GetMostPossibleTime> mostPossibleTimes) {
return GetUserParticipatedEventsResponse.builder()
.eventId(event.getEventId())
.title(event.getTitle())
.createdDate(String.valueOf(event.getCreatedDate()))
.participantCount(participantCount)
.eventStatus(String.valueOf(eventParticipation.getEventStatus()))
.mostPossibleTimes(mostPossibleTimes)
.build();
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/side/onetime/service/EventService.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ public List<EventDto.GetUserParticipatedEventsResponse> getUserParticipatedEvent
Event event = eventParticipation.getEvent();
int memberCount = memberRepository.countByEvent(event);
int participantCount = eventParticipationRepository.countByEvent(event);
return EventDto.GetUserParticipatedEventsResponse.of(event, eventParticipation, memberCount + participantCount);
List<EventDto.GetMostPossibleTime> mostPossibleTimes = getMostPossibleTime(String.valueOf(event.getEventId()));
return EventDto.GetUserParticipatedEventsResponse.of(event, eventParticipation, memberCount + participantCount, mostPossibleTimes);
})
.collect(Collectors.toList());
}
Expand Down

0 comments on commit 446253f

Please sign in to comment.