diff --git a/src/main/java/com/dnd/snappy/domain/mission/repository/MissionRepository.java b/src/main/java/com/dnd/snappy/domain/mission/repository/MissionRepository.java index a877dee..5a5bc0c 100644 --- a/src/main/java/com/dnd/snappy/domain/mission/repository/MissionRepository.java +++ b/src/main/java/com/dnd/snappy/domain/mission/repository/MissionRepository.java @@ -20,10 +20,9 @@ public interface MissionRepository extends JpaRepository { SELECT new com.dnd.snappy.domain.mission.dto.response.LeaderMeetingMissionDetailResponseDto(m.id, m.content, CASE WHEN mp.id IS NOT NULL THEN TRUE ELSE FALSE END) FROM Mission m - LEFT JOIN MissionParticipant mp ON mp.mission.id = m.id - JOIN Participant p ON p.meeting.id = m.meeting.id - WHERE p.id = :participantId AND p.role = 'LEADER' AND m.meeting.id = :meetingId + LEFT JOIN MissionParticipant mp ON mp.mission.id = m.id + WHERE m.meeting.id = :meetingId """) - List findLeaderMeetingMissions(@Param("meetingId") Long meetingId, @Param("participantId") Long participantId); + List findLeaderMeetingMissions(@Param("meetingId") Long meetingId); } \ No newline at end of file diff --git a/src/main/java/com/dnd/snappy/domain/mission/service/MissionDetailService.java b/src/main/java/com/dnd/snappy/domain/mission/service/MissionDetailService.java index c62fe9f..8c85805 100644 --- a/src/main/java/com/dnd/snappy/domain/mission/service/MissionDetailService.java +++ b/src/main/java/com/dnd/snappy/domain/mission/service/MissionDetailService.java @@ -38,7 +38,7 @@ public List findLeaderMeetingMissions(Lon findByMeetingIdOrThrow(meetingId); missionValidationService.validateIsLeader(participantId, meetingId); - return missionRepository.findLeaderMeetingMissions(meetingId, participantId); + return missionRepository.findLeaderMeetingMissions(meetingId); } private Meeting findByMeetingIdOrThrow(Long meetingId) { diff --git a/src/test/java/com/dnd/snappy/controller/v1/mission/MissionDetailControllerTest.java b/src/test/java/com/dnd/snappy/controller/v1/mission/MissionDetailControllerTest.java index b8ab2c3..48fd676 100644 --- a/src/test/java/com/dnd/snappy/controller/v1/mission/MissionDetailControllerTest.java +++ b/src/test/java/com/dnd/snappy/controller/v1/mission/MissionDetailControllerTest.java @@ -62,6 +62,7 @@ void findLeaderMeetingMissions() throws Exception { Meeting meeting = createMeeting(); Participant leader = createParticipant(meeting, Role.LEADER); Participant participant = createParticipant(meeting, Role.PARTICIPANT); + Participant participant2 = createParticipant(meeting, Role.PARTICIPANT); Mission mission = Mission.builder() .meeting(meeting) @@ -69,6 +70,12 @@ void findLeaderMeetingMissions() throws Exception { .build(); missionRepository.save(mission); + Mission mission2 = Mission.builder() + .meeting(meeting) + .content("미션 내용2") + .build(); + missionRepository.save(mission2); + MissionParticipant missionParticipant = MissionParticipant.builder() .participant(participant) .mission(mission) diff --git a/src/test/java/com/dnd/snappy/domain/mission/service/MissionDetailServiceTest.java b/src/test/java/com/dnd/snappy/domain/mission/service/MissionDetailServiceTest.java index bd48bd5..efe3790 100644 --- a/src/test/java/com/dnd/snappy/domain/mission/service/MissionDetailServiceTest.java +++ b/src/test/java/com/dnd/snappy/domain/mission/service/MissionDetailServiceTest.java @@ -88,7 +88,7 @@ void findLeaderMeetingMissions() { given(meetingRepository.findById(meetingId)).willReturn(Optional.of(meeting)); doNothing().when(missionValidationService).validateIsLeader(participantId, meetingId); - given(missionRepository.findLeaderMeetingMissions(meetingId, participantId)).willReturn( + given(missionRepository.findLeaderMeetingMissions(meetingId)).willReturn( List.of( new LeaderMeetingMissionDetailResponseDto(1L, "미션 내용 1", false), new LeaderMeetingMissionDetailResponseDto(2L, "미션 내용 2", false),