1

create links

Co-authored-by: Christoph <tobi@urpost.de>
This commit is contained in:
Christoph
2020-03-26 17:10:15 +01:00
parent 9302bc68b5
commit 68a9ddeecc
2 changed files with 18 additions and 3 deletions

View File

@ -32,11 +32,13 @@ public class ControllerService {
private final EventService eventService;
private final UserService userService;
private final InviteService inviteService;
private final Logger logger;
public ControllerService(EventService eventService, UserService userService) {
public ControllerService(EventService eventService, UserService userService, InviteService inviteService) {
this.eventService = eventService;
this.userService = userService;
this.inviteService = inviteService;
this.logger = Logger.getLogger("controllerServiceLogger");
}
@ -49,6 +51,8 @@ public class ControllerService {
* @param title Gruppentitel
* @param description Gruppenbeschreibung
*/
//TODO: better assignments
//TODO: createGroup + createOrga auslagern
public void createGroup(Account account, String title, String description, Boolean visibility, Boolean maxInfiniteUsers, Long userMaximum, UUID parent) throws EventException {
Visibility visibility1;
maxInfiniteUsers = maxInfiniteUsers != null;
@ -69,6 +73,8 @@ public class ControllerService {
CreateGroupEvent createGroupEvent = new CreateGroupEvent(groupId, account.getName(), parent, GroupType.SIMPLE, visibility1, userMaximum);
eventService.saveEvent(createGroupEvent);
inviteService.createLink(groupId);
addUser(account, groupId);
updateTitle(account, groupId, title);
updateDescription(account, groupId, description);
@ -92,6 +98,8 @@ public class ControllerService {
visibility1 = Visibility.PRIVATE;
}
inviteService.createLink(groupId);
GroupType groupType;
if (lecture) {
groupType = GroupType.LECTURE;
@ -143,6 +151,7 @@ public class ControllerService {
eventService.saveEvent(updateUserMaxEvent);
}
//TODO: updateRole + deleteUser, teilweise auslagern zu userInGroup oder sowas
public void updateRole(String userId, UUID groupId) throws EventException {
UpdateRoleEvent updateRoleEvent;
Group group = userService.getGroupById(groupId);
@ -184,6 +193,7 @@ public class ControllerService {
public void deleteGroupEvent(String userId, UUID groupId) {
DeleteGroupEvent deleteGroupEvent = new DeleteGroupEvent(groupId, userId);
inviteService.destroyLink(groupId);
eventService.saveEvent(deleteGroupEvent);
}