diff --git a/src/main/java/org/pingle/pingleserver/repository/MeetingRepository.java b/src/main/java/org/pingle/pingleserver/repository/MeetingRepository.java index 605dba7..1ee50fd 100644 --- a/src/main/java/org/pingle/pingleserver/repository/MeetingRepository.java +++ b/src/main/java/org/pingle/pingleserver/repository/MeetingRepository.java @@ -17,7 +17,7 @@ public interface MeetingRepository extends JpaRepository { "JOIN UserMeeting um ON um.meeting = m " + "WHERE um.user.id = :userId " + " AND (:teamId IS NULL OR t.id = :teamId) " + - " AND m.startAt > :currentDateTime " + + " AND m.endAt > :currentDateTime " + "ORDER BY m.startAt ASC") List findUnparticipatedMeetingsForUsersInTeamOrderByTime(Long userId, Long teamId, @Param("currentDateTime")LocalDateTime currentDateTime); @@ -27,7 +27,7 @@ public interface MeetingRepository extends JpaRepository { "JOIN UserMeeting um ON um.meeting = m " + "WHERE um.user.id = :userId " + " AND (:teamId IS NULL OR t.id = :teamId) " + - " AND m.startAt <= :currentDateTime " + + " AND m.endAt <= :currentDateTime " + "ORDER BY m.startAt DESC") List findParticipatedMeetingsForUsersInTeamOrderByTime(Long userId, Long teamId, @Param("currentDateTime")LocalDateTime currentDateTime); diff --git a/src/main/java/org/pingle/pingleserver/service/MeetingService.java b/src/main/java/org/pingle/pingleserver/service/MeetingService.java index f4ed9c2..68b33a6 100644 --- a/src/main/java/org/pingle/pingleserver/service/MeetingService.java +++ b/src/main/java/org/pingle/pingleserver/service/MeetingService.java @@ -51,9 +51,9 @@ public ParticipantsResponse getParticipants(Long meetingId) { public List getMyPingles(Long userId, Long teamId, boolean participation) { List myMeetings = new ArrayList<>(); - if(participation) // 참여 완려 -> 이미 시작 startAt이 현재보다 + if(participation) // 참여 완려 -> 이미 시작 endAt 이 현재보다 빠름 myMeetings = meetingRepository.findParticipatedMeetingsForUsersInTeamOrderByTime(userId, teamId, LocalDateTime.now()); - if(!participation) // 참여하지 않은 것 == 나중에 일어날 것 -> startat이 현재보다 늦음 + if(!participation) // 참여하지 않은 것 == 나중에 일어날 것 -> endAt이 현재보다 늦음 myMeetings = meetingRepository.findUnparticipatedMeetingsForUsersInTeamOrderByTime(userId, teamId, LocalDateTime.now()); return myMeetings.stream() .map(meeting -> MyPingleResponse.of(meeting, getOwnerName(meeting), isOwner(userId, meeting.getId()))).toList();