Skip to content

Commit

Permalink
fix: 모임 리더 - MeetingMember 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
f1v3-dev committed Sep 24, 2024
1 parent f1fe63e commit 8126e65
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.dnd.jjakkak.domain.meeting.entity.QMeeting;
import com.dnd.jjakkak.domain.meeting.enums.MeetingSort;
import com.dnd.jjakkak.domain.meetingcategory.entity.QMeetingCategory;
import com.dnd.jjakkak.domain.member.entity.QMember;
import com.dnd.jjakkak.domain.schedule.entity.QSchedule;
import com.querydsl.core.types.OrderSpecifier;
import com.querydsl.core.types.Projections;
Expand Down Expand Up @@ -196,14 +197,16 @@ public MeetingParticipantResponseDto getParticipant(String uuid) {
@Override
public boolean existsByMemberIdAndMeetingUuid(Long memberId, String meetingUuid) {

QMeeting meeting = QMeeting.meeting;
QSchedule schedule = QSchedule.schedule;
QMeeting meeting = QMeeting.meeting;
QMember member = QMember.member;

return from(schedule)
.join(schedule.meeting, meeting)
.join(schedule.member, member)
.where(meeting.meetingUuid.eq(meetingUuid)
.and(schedule.member.memberId.eq(memberId)))
.select(schedule.count())
.fetchOne() > 0;
.and(member.memberId.eq(memberId)))
.fetchCount() > 0;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ public void createMeetingMemberBySchedule(Long scheduleId, Long memberId) {
Schedule schedule = scheduleRepository.findById(scheduleId)
.orElseThrow(ScheduleNotFoundException::new);

MeetingMember meetingMember = MeetingMember.builder()
.pk(pk)
.member(member)
.meeting(schedule.getMeeting())
.build();

meetingMemberRepository.save(meetingMember);
// 이미 리더는 모임을 생성할 때 회원으로 추가되어 있으므로 제외
if (!schedule.getMeeting().getMeetingLeaderId().equals(memberId)) {
MeetingMember meetingMember = MeetingMember.builder()
.pk(pk)
.member(member)
.meeting(schedule.getMeeting())
.build();

meetingMemberRepository.save(meetingMember);
}
}

/**
Expand Down

0 comments on commit 8126e65

Please sign in to comment.