Skip to content

Commit

Permalink
#318 [fix] 클래스 명 접미사에 vo 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
KWY0218 committed Aug 20, 2024
1 parent b391e6a commit fe9b35d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import com.asap.server.persistence.repository.UserMeetingScheduleRepository;
import com.asap.server.service.time.dto.UserMeetingScheduleRegisterDto;
import com.asap.server.service.time.vo.TimeBlockVo;
import com.asap.server.service.time.vo.UserScheduleByTimeSlot;
import com.asap.server.service.time.vo.UserScheduleByTimeSlot.CompositeKey;
import com.asap.server.service.time.vo.UserScheduleByTimeSlotVo;
import com.asap.server.service.time.vo.UserScheduleByTimeSlotVo.CompositeKey;
import java.util.List;
import java.util.Map.Entry;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -43,22 +43,22 @@ public List<TimeBlockVo> getTimeBlocks(final Long meetingId) {

return userMeetingSchedules.stream()
.flatMap(this::convertToUserScheduleByTimeSlot)
.collect(Collectors.groupingBy(UserScheduleByTimeSlot::composeKey))
.collect(Collectors.groupingBy(UserScheduleByTimeSlotVo::composeKey))
.entrySet().stream()
.map(this::convertToTimeBlock)
.sorted()
.toList();
}

private Stream<UserScheduleByTimeSlot> convertToUserScheduleByTimeSlot(
private Stream<UserScheduleByTimeSlotVo> convertToUserScheduleByTimeSlot(
final UserMeetingSchedule userMeetingSchedule
) {
return TimeSlot.getTimeSlots(
userMeetingSchedule.getStartTimeSlot().getIndex(),
userMeetingSchedule.getEndTimeSlot().getIndex()
)
.stream()
.map(timeSlot -> new UserScheduleByTimeSlot(
.map(timeSlot -> new UserScheduleByTimeSlotVo(
userMeetingSchedule.getId(),
userMeetingSchedule.getAvailableDate(),
userMeetingSchedule.getUserId(),
Expand All @@ -69,14 +69,14 @@ private Stream<UserScheduleByTimeSlot> convertToUserScheduleByTimeSlot(
}

private TimeBlockVo convertToTimeBlock(
final Entry<CompositeKey, List<UserScheduleByTimeSlot>> entry
final Entry<CompositeKey, List<UserScheduleByTimeSlotVo>> entry
) {
List<Long> userIds = entry.getValue().stream()
.map(UserScheduleByTimeSlot::userId)
.map(UserScheduleByTimeSlotVo::userId)
.toList();

int weight = entry.getValue().stream()
.mapToInt(UserScheduleByTimeSlot::weight)
.mapToInt(UserScheduleByTimeSlotVo::weight)
.sum();

return new TimeBlockVo(entry.getKey().availableDate(), entry.getKey().time(), weight, userIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.asap.server.persistence.domain.enums.TimeSlot;
import java.time.LocalDate;

public record UserScheduleByTimeSlot(
public record UserScheduleByTimeSlotVo(
Long id,
LocalDate availableDate,
Long userId,
Expand Down

0 comments on commit fe9b35d

Please sign in to comment.