1
Co-authored-by: Christoph <tobi@urpost.de>
This commit is contained in:
Christoph
2020-03-27 12:57:47 +01:00
parent cc64943663
commit 56a81ce66f
7 changed files with 26 additions and 25 deletions

View File

@ -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());