@ -8,6 +8,7 @@ import mops.gruppen2.domain.event.Event;
|
||||
import mops.gruppen2.domain.exception.EventException;
|
||||
import mops.gruppen2.repository.EventRepository;
|
||||
import mops.gruppen2.security.Account;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -77,6 +78,7 @@ public class GroupService {
|
||||
* @throws EventException Projektionsfehler
|
||||
*/
|
||||
//TODO Rename
|
||||
@Cacheable("groups")
|
||||
public List<Group> getAllGroupWithVisibilityPublic(String userId) throws EventException {
|
||||
List<Event> groupEvents = eventService.translateEventDTOs(eventRepository.findAllEventsByType("CreateGroupEvent"));
|
||||
groupEvents.addAll(eventService.translateEventDTOs(eventRepository.findAllEventsByType("UpdateGroupDescriptionEvent")));
|
||||
@ -100,6 +102,7 @@ public class GroupService {
|
||||
*
|
||||
* @return List of groups
|
||||
*/
|
||||
@Cacheable("groups")
|
||||
public List<Group> getAllLecturesWithVisibilityPublic() {
|
||||
List<Event> createEvents = eventService.translateEventDTOs(eventRepository.findAllEventsByType("CreateGroupEvent"));
|
||||
createEvents.addAll(eventService.translateEventDTOs(eventRepository.findAllEventsByType("DeleteGroupEvent")));
|
||||
@ -124,6 +127,7 @@ public class GroupService {
|
||||
* @throws EventException Projektionsfehler
|
||||
*/
|
||||
//Todo Rename
|
||||
@Cacheable("groups")
|
||||
public List<Group> findGroupWith(String search, Account account) throws EventException {
|
||||
if (search.isEmpty()) {
|
||||
return getAllGroupWithVisibilityPublic(account.getName());
|
||||
|
||||
Reference in New Issue
Block a user