diff --git a/src/main/java/com/dnd/jjakkak/domain/meeting/dto/response/MeetingTime.java b/src/main/java/com/dnd/jjakkak/domain/meeting/dto/response/MeetingTime.java index 39fcb00..0e46335 100644 --- a/src/main/java/com/dnd/jjakkak/domain/meeting/dto/response/MeetingTime.java +++ b/src/main/java/com/dnd/jjakkak/domain/meeting/dto/response/MeetingTime.java @@ -33,4 +33,15 @@ public MeetingTime(LocalDateTime startTime, LocalDateTime endTime, Double rank) public void addMemberNames(List memberNames) { this.memberNames.addAll(memberNames); } + + public void setAnonymous() { + + List anonymous = new ArrayList<>(); + for (int i = 1; i <= memberNames.size(); i++) { + anonymous.add("익명" + i); + } + + this.memberNames.clear(); + this.memberNames.addAll(anonymous); + } } diff --git a/src/main/java/com/dnd/jjakkak/domain/meeting/repository/MeetingRepositoryImpl.java b/src/main/java/com/dnd/jjakkak/domain/meeting/repository/MeetingRepositoryImpl.java index d9bda83..9b12a2a 100644 --- a/src/main/java/com/dnd/jjakkak/domain/meeting/repository/MeetingRepositoryImpl.java +++ b/src/main/java/com/dnd/jjakkak/domain/meeting/repository/MeetingRepositoryImpl.java @@ -162,26 +162,19 @@ public PagedResponse getMeetingTimes(String uuid, Pageab .select(dateOfSchedule.dateOfScheduleRank.count()) .fetchCount(); - // 3. 익명 모임이 아닌 경우, 일정을 할당한 사용자의 닉네임 조회 후 추가 - Boolean isAnonymous = from(meeting) - .where(meeting.meetingUuid.eq(uuid)) - .select(meeting.isAnonymous) - .fetchOne(); + // 3. 일정을 할당한 사용자의 닉네임 조회 후 추가 + for (MeetingTime meetingTime : meetingTimeList) { + List nicknames = from(dateOfSchedule) + .join(dateOfSchedule.schedule, schedule) + .join(schedule.meeting, meeting) + .where(meeting.meetingUuid.eq(uuid) + .and(dateOfSchedule.dateOfScheduleStart.eq(meetingTime.getStartTime())) + .and(dateOfSchedule.dateOfScheduleEnd.eq(meetingTime.getEndTime())) + .and(schedule.assignedAt.loe(requestTime))) + .select(schedule.scheduleNickname) + .fetch(); - if (Boolean.FALSE.equals(isAnonymous)) { - for (MeetingTime meetingTime : meetingTimeList) { - List nicknames = from(dateOfSchedule) - .join(dateOfSchedule.schedule, schedule) - .join(schedule.meeting, meeting) - .where(meeting.meetingUuid.eq(uuid) - .and(dateOfSchedule.dateOfScheduleStart.eq(meetingTime.getStartTime())) - .and(dateOfSchedule.dateOfScheduleEnd.eq(meetingTime.getEndTime())) - .and(schedule.assignedAt.loe(requestTime))) - .select(schedule.scheduleNickname) - .fetch(); - - meetingTime.addMemberNames(nicknames); - } + meetingTime.addMemberNames(nicknames); } // 4. PageInfo 생성 diff --git a/src/main/java/com/dnd/jjakkak/domain/meeting/service/MeetingService.java b/src/main/java/com/dnd/jjakkak/domain/meeting/service/MeetingService.java index 52d9b04..3fad544 100644 --- a/src/main/java/com/dnd/jjakkak/domain/meeting/service/MeetingService.java +++ b/src/main/java/com/dnd/jjakkak/domain/meeting/service/MeetingService.java @@ -4,10 +4,7 @@ import com.dnd.jjakkak.domain.category.exception.CategoryNotFoundException; import com.dnd.jjakkak.domain.category.repository.CategoryRepository; import com.dnd.jjakkak.domain.meeting.dto.request.MeetingCreateRequestDto; -import com.dnd.jjakkak.domain.meeting.dto.response.MeetingCreateResponseDto; -import com.dnd.jjakkak.domain.meeting.dto.response.MeetingInfoResponseDto; -import com.dnd.jjakkak.domain.meeting.dto.response.MeetingParticipantResponseDto; -import com.dnd.jjakkak.domain.meeting.dto.response.MeetingTimeResponseDto; +import com.dnd.jjakkak.domain.meeting.dto.response.*; import com.dnd.jjakkak.domain.meeting.entity.Meeting; import com.dnd.jjakkak.domain.meeting.exception.MeetingNotFoundException; import com.dnd.jjakkak.domain.meeting.exception.MeetingUnauthorizedException; @@ -173,7 +170,16 @@ public PagedResponse getMeetingTimes(String uuid, Pageab throw new MeetingNotFoundException(); } - return meetingRepository.getMeetingTimes(uuid, pageable, requestTime); + PagedResponse meetingTimes = meetingRepository.getMeetingTimes(uuid, pageable, requestTime); + + if (Boolean.TRUE.equals(meetingTimes.getData().getIsAnonymous())) { + List meetingTimeList = meetingTimes.getData().getMeetingTimeList(); + for (MeetingTime meetingTime : meetingTimeList) { + meetingTime.setAnonymous(); + } + } + + return meetingTimes; } /**