Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sj fix/69 #83

Merged
merged 2 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public interface MeetingRepository extends JpaRepository<Meeting, Long> {
@Query("SELECT COUNT(m) FROM Meeting m WHERE m.pin.id = :pinId AND m.startAt > CURRENT_TIMESTAMP AND m.category = :category")
int countMeetingsForPin(Long pinId, MCategory category);

List<Meeting> findByPinIdAndCategoryAndStartAtAfter(Long pinId, MCategory category, LocalDateTime currentTime);
List<Meeting> findByPinIdAndCategoryAndStartAtAfterOrderByStartAt(Long pinId, MCategory category, LocalDateTime currentTime);

List<Meeting> findByPinIdAndStartAtAfter(Long pinId, LocalDateTime currentTime);
List<Meeting> findByPinIdAndStartAtAfterOrderByStartAt(Long pinId, LocalDateTime currentTime);
}
4 changes: 2 additions & 2 deletions src/main/java/org/pingle/pingleserver/service/PinService.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ public List<MeetingResponse> getMeetings(Long pinId, Long userId, MCategory cate
List<Meeting> meetings;

if (category == null){
meetings = meetingRepository.findByPinIdAndStartAtAfter(pinId, LocalDateTime.now());
meetings = meetingRepository.findByPinIdAndStartAtAfterOrderByStartAt(pinId, LocalDateTime.now());
} else {
meetings = meetingRepository.findByPinIdAndCategoryAndStartAtAfter(pinId, category, LocalDateTime.now());
meetings = meetingRepository.findByPinIdAndCategoryAndStartAtAfterOrderByStartAt(pinId, category, LocalDateTime.now());
}
return meetings.stream()
.map(meeting -> MeetingResponse.of(meeting, getOwnerName(meeting), getCurParticipants(meeting),
Expand Down