1

Add method to get all lectures that are public

This commit is contained in:
XXNitram
2020-03-20 02:32:37 +01:00
parent d43e62bb1d
commit 479db666a3

View File

@ -1,6 +1,7 @@
package mops.gruppen2.service; package mops.gruppen2.service;
import mops.gruppen2.domain.Group; import mops.gruppen2.domain.Group;
import mops.gruppen2.domain.GroupType;
import mops.gruppen2.domain.User; import mops.gruppen2.domain.User;
import mops.gruppen2.domain.dto.EventDTO; import mops.gruppen2.domain.dto.EventDTO;
import mops.gruppen2.domain.event.Event; import mops.gruppen2.domain.event.Event;
@ -96,6 +97,18 @@ public class GroupService {
return removeUserGroups(visibleGroups, newGroups); return removeUserGroups(visibleGroups, newGroups);
} }
public List<Group> getAllLecturesWithVisibilityPublic() throws EventException {
List<Event> eventsVisible = eventService.translateEventDTOs(eventRepository.findAllEventsOfGroups(eventRepository.findGroup_idsWhereVisibility(Boolean.TRUE)));
List<Group> visibleGroups = projectEventList(eventsVisible);
List<Group> visibleLectures = new ArrayList<>();
for (Group group : visibleGroups) {
if (group.getType().equals(GroupType.LECTURE)) {
visibleLectures.add(group);
}
}
return visibleLectures;
}
/** /**
* Filtert alle öffentliche Gruppen nach dem Suchbegriff und gibt diese als Liste von Gruppen zurück. * Filtert alle öffentliche Gruppen nach dem Suchbegriff und gibt diese als Liste von Gruppen zurück.