Skip to content

Commit

Permalink
[fix] change filter to endAt instead of startAt(during QA)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkdwns414 committed Jan 18, 2024
1 parent 8ebf0ed commit e82640a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface MeetingRepository extends JpaRepository<Meeting, Long> {
"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<Meeting> findUnparticipatedMeetingsForUsersInTeamOrderByTime(Long userId, Long teamId, @Param("currentDateTime")LocalDateTime currentDateTime);

Expand All @@ -27,7 +27,7 @@ public interface MeetingRepository extends JpaRepository<Meeting, Long> {
"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<Meeting> findParticipatedMeetingsForUsersInTeamOrderByTime(Long userId, Long teamId, @Param("currentDateTime")LocalDateTime currentDateTime);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public ParticipantsResponse getParticipants(Long meetingId) {

public List<MyPingleResponse> getMyPingles(Long userId, Long teamId, boolean participation) {
List<Meeting> 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();
Expand Down

0 comments on commit e82640a

Please sign in to comment.