1

add functionality for group_ids to User class

Co-Authored-By: tomvahl <tomvahl@users.noreply.github.com>
This commit is contained in:
killerber4t
2020-03-10 16:54:48 +01:00
parent 07462fae36
commit 68789099be
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,26 @@
package mops.gruppen2.service;
import mops.gruppen2.domain.User;
import mops.gruppen2.domain.event.Event;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TeilnehmerService {
GroupService groupService;
EventService eventService;
public TeilnehmerService(GroupService groupService, EventService eventService){
this.eventService = eventService;
this.groupService = groupService;
}
public void assignGroups(User user){
List<Event> events = eventService.findAllEvents();
for (Event event: events) {
if(user.getUser_id().equals(event.getUser_id())) user.addGroup(event.getGroup_id());
}
}
}