Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#319 [feat] 기존 시간 입력 로직 제거 #325

Merged
merged 9 commits into from
Aug 25, 2024
58 changes: 0 additions & 58 deletions src/main/java/com/asap/server/persistence/domain/TimeBlock.java

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ public interface UserMeetingScheduleRepository extends Repository<UserMeetingSch
void save(final UserMeetingSchedule userMeetingSchedule);

List<UserMeetingSchedule> findAllByMeetingId(final long meetingId);

int countAllByUserId(final long hostId);
}

This file was deleted.

35 changes: 4 additions & 31 deletions src/main/java/com/asap/server/service/AvailableDateService.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.asap.server.service;

import com.asap.server.common.utils.DateUtil;
import com.asap.server.presentation.controller.dto.response.AvailableDateResponseDto;
import com.asap.server.presentation.controller.dto.response.AvailableDatesDto;
import com.asap.server.presentation.controller.dto.response.TimeSlotDto;
import com.asap.server.persistence.domain.AvailableDate;
import com.asap.server.persistence.domain.Meeting;
import com.asap.server.common.exception.Error;
import com.asap.server.common.exception.model.BadRequestException;
import com.asap.server.common.exception.model.NotFoundException;
import com.asap.server.common.utils.DateUtil;
import com.asap.server.persistence.domain.AvailableDate;
import com.asap.server.persistence.domain.Meeting;
import com.asap.server.persistence.repository.AvailableDateRepository;
import com.asap.server.presentation.controller.dto.response.AvailableDateResponseDto;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
Expand All @@ -23,8 +21,6 @@ public class AvailableDateService {
private static final int DAY_ELEMENT_INDEX = 2;

private final AvailableDateRepository availableDateRepository;
private final TimeBlockService timeBlockService;
private final TimeBlockUserService timeBlockUserService;


public List<AvailableDateResponseDto> getAvailableDates(final Meeting meeting) {
Expand All @@ -48,29 +44,6 @@ public List<AvailableDate> findAvailableDateByMeeting(final Meeting meeting) {
return availableDates;
}

public AvailableDatesDto getAvailableDatesDto(final AvailableDate availableDate, final int memberCount) {
List<TimeSlotDto> timeSlotDtos = timeBlockService.findByAvailableDate(availableDate).stream().map(
timeBlock -> timeBlockUserService.getTimeSlotDto(timeBlock, memberCount)
).collect(Collectors.toList());

return AvailableDatesDto.builder()
.timeSlots(timeSlotDtos)
.month(DateUtil.getMonth(availableDate.getDate()))
.day(DateUtil.getDay(availableDate.getDate()))
.dayOfWeek(DateUtil.getDayOfWeek(availableDate.getDate()))
.build();
}

;

public AvailableDate findByMeetingAndDate(final Meeting meeting,
final String month,
final String day) {
return availableDateRepository.findByMeetingAndDate(meeting,
DateUtil.transformLocalDate(month, day))
.orElseThrow(() -> new NotFoundException(Error.AVAILABLE_DATE_NOT_FOUND_EXCEPTION));
}

private List<AvailableDate> findAvailableDates(final Meeting meeting) {
List<AvailableDate> availableDates = availableDateRepository.findByMeeting(meeting);

Expand Down
23 changes: 0 additions & 23 deletions src/main/java/com/asap/server/service/MeetingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,29 +143,6 @@ public FixedMeetingResponseDto getFixedMeetingInformation(final Long meetingId)
.build();
}

public TimeTableResponseDto getTimeTable(final Long userId, final Long meetingId) {
Meeting meeting = meetingRepository.findById(meetingId)
.orElseThrow(() -> new NotFoundException(Error.MEETING_NOT_FOUND_EXCEPTION));

if (!meeting.authenticateHost(userId))
throw new UnauthorizedException(INVALID_MEETING_HOST_EXCEPTION);

if (meeting.isConfirmedMeeting())
throw new ConflictException(MEETING_VALIDATION_FAILED_EXCEPTION);

List<String> memberNames = userService.findUserNameByMeeting(meeting);

List<AvailableDatesDto> availableDatesDtos = availableDateService.findAvailableDateByMeeting(meeting).stream()
.map(availableDate -> availableDateService.getAvailableDatesDto(availableDate, memberNames.size()))
.collect(Collectors.toList());

return TimeTableResponseDto.builder()
.totalUserNames(memberNames)
.memberCount(memberNames.size())
.availableDateTimes(availableDatesDtos)
.build();
}

public MeetingTitleResponseDto getIsFixedMeeting(final Long meetingId) throws ConflictException {
Meeting meeting = meetingRepository.findById(meetingId)
.orElseThrow(() -> new NotFoundException(Error.MEETING_NOT_FOUND_EXCEPTION));
Expand Down
53 changes: 0 additions & 53 deletions src/main/java/com/asap/server/service/TimeBlockService.java

This file was deleted.

50 changes: 0 additions & 50 deletions src/main/java/com/asap/server/service/TimeBlockUserService.java

This file was deleted.

Loading
Loading