[SIS-7] only showing confirmed meetups in meetup list command, fixing #7

This commit is contained in:
Sheldan
2022-07-04 23:04:39 +02:00
parent 1f5aebef1c
commit b5498ab79a
3 changed files with 6 additions and 1 deletions

View File

@@ -61,7 +61,7 @@ public class ListMeetups extends AbstractConditionableCommand {
}
private MessageToSend getMessageToSend(Long serverId) {
List<Meetup> meetups = meetupManagementServiceBean.getFutureMeetups();
List<Meetup> meetups = meetupManagementServiceBean.getIncomingMeetups();
List<MeetupListItemModel> listItems = meetups
.stream()
.map(MeetupListItemModel::fromMeetup)

View File

@@ -13,5 +13,6 @@ import java.util.List;
public interface MeetupRepository extends JpaRepository<Meetup, ServerSpecificId> {
List<Meetup> findByMeetupTimeLessThan(Instant date);
List<Meetup> findByMeetupTimeGreaterThan(Instant date);
List<Meetup> findByMeetupTimeGreaterThanAndState(Instant date, MeetupState state);
List<Meetup> findByState(MeetupState state);
}

View File

@@ -66,6 +66,10 @@ public class MeetupManagementServiceBean {
return meetupRepository.findByMeetupTimeGreaterThan(Instant.now());
}
public List<Meetup> getIncomingMeetups() {
return meetupRepository.findByMeetupTimeGreaterThanAndState(Instant.now(), MeetupState.CONFIRMED);
}
public void deleteMeetups(List<Meetup> meetups) {
meetupRepository.deleteAll(meetups);
}