Skip to content

Commit

Permalink
♻️ Recycle: 모임 일정 수정로직 에서 추가할 모임 참여자 로직 삭제
Browse files Browse the repository at this point in the history
<footer>
- 관련: #419
  • Loading branch information
joowojr committed Dec 1, 2024
1 parent 88e871e commit a0b9c01
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ public static class PatchMeetingScheduleDto {
private PeriodDto period;
@Schema(description = "카카오 맵 장소 정보, 수정 사항이 없을 시 원본 값을 전송합니다.")
private LocationDto location;
@NotNull(message = "추가할 유저가 없을 시 empty array를 전송하세요.")
@Schema(description = "스케줄에 추가할 유저 ID(userId), 추가할 유저가 없을 시 empty array를 전송합니다.")
private List<Long> participantsToAdd;
}

@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,6 @@ public void updateMeetingSchedule(MeetingScheduleRequest.PatchMeetingScheduleDto
Participant participant = validateAndGetOwnerParticipant(schedule, memberId);
updateScheduleContent(request.getTitle(), request.getLocation(), request.getPeriod(), request.getImageUrl(), schedule);
participant.updateCustomScheduleInfo(request.getTitle(), request.getImageUrl());
// 기존의 인원과, 초대될 & 삭제될 member 검증
if (!request.getParticipantsToAdd().isEmpty()) {
List<Long> participantIds = getScheduleParticipantIds(schedule.getId());
validateParticipantCount(
participantIds.size() + request.getParticipantsToAdd().size());
validateExistingAndNewParticipantIds(participantIds, request.getParticipantsToAdd());
participantManageService.updateMeetingScheduleParticipants(memberId, schedule, request);
}
}

/**
Expand All @@ -229,23 +221,6 @@ public void updateMeetingScheduleProfile(MeetingScheduleRequest.PatchMeetingSche
participant.updateCustomScheduleInfo(request.getTitle(), request.getImageUrl());
}

/**
* 모임 일정에 대한 모든 참여자의 ID를 반환합니다,
* 반환 값에는 활성, 비활성 모든 상태의 참여자가 포함됩니다.
* 모임 일정 초대 인원 수를 검증하기 위해 사용합니다.
*
* @param scheduleId
* @return 모임 일정에 대한 모든 참여자의 ID 배열
*/
public List<Long> getScheduleParticipantIds(Long scheduleId) {
List<Long> participantIds = participantService.readParticipantsByScheduleId(scheduleId).stream()
.filter(participant -> participant.getIsOwner() == ParticipantRole.NON_OWNER.getValue())
.map(Participant::getMember)
.map(Member::getId)
.collect(Collectors.toList());
return participantIds;
}

private void updateScheduleContent(String title, MeetingScheduleRequest.LocationDto locationDto,
MeetingScheduleRequest.PeriodDto periodDto, String imageUrl, Schedule schedule) {
Period period = getValidatedPeriod(periodDto.getStartDate(), periodDto.getEndDate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public MeetingScheduleResponse.GetMeetingScheduleDto getMeetingSchedule(Long sch
@Transactional
public void updateMeetingSchedule(MeetingScheduleRequest.PatchMeetingScheduleDto request, Long scheduleId,
SecurityUserDetails memberInfo) {
validateUniqueParticipantIds(memberInfo.getUserId(), request);
Schedule schedule = scheduleManageService.getMeetingSchedule(scheduleId);
scheduleManageService.updateMeetingSchedule(request, schedule, memberInfo.getUserId());
}
Expand All @@ -107,7 +106,7 @@ public void updateMeetingScheduleProfile(MeetingScheduleRequest.PatchMeetingSche
public String getGuestInvitationUrl(Long scheduleId, SecurityUserDetails memberInfo) {
Schedule schedule = scheduleManageService.getMeetingSchedule(scheduleId);
scheduleManageService.validateAndGetOwnerParticipant(schedule, memberInfo.getUserId());
validateParticipantCount(scheduleManageService.getScheduleParticipantIds(schedule.getId()).size());
validateParticipantCount(participantManageService.getScheduleParticipantIds(schedule.getId()).size());
return guestManageService.generateInvitationUrl(scheduleId);
}

Expand Down

0 comments on commit a0b9c01

Please sign in to comment.