1

Merge remote-tracking branch 'origin/groups-for-user' into groups-for-user

This commit is contained in:
tomvahl
2020-03-12 15:46:14 +01:00
4 changed files with 21 additions and 3 deletions

View File

@ -7,6 +7,8 @@ import mops.gruppen2.domain.User;
import mops.gruppen2.domain.Visibility;
import mops.gruppen2.domain.event.AddUserEvent;
import mops.gruppen2.domain.event.CreateGroupEvent;
import mops.gruppen2.domain.event.UpdateGroupDescriptionEvent;
import mops.gruppen2.domain.event.UpdateGroupTitleEvent;
import mops.gruppen2.security.Account;
import mops.gruppen2.service.EventService;
import mops.gruppen2.service.GroupService;
@ -81,8 +83,12 @@ public class Gruppen2Controller {
Account account = keyCloakService.createAccountFromPrincipal(token);
CreateGroupEvent createGroupEvent = new CreateGroupEvent(eventService.checkGroup(), account.getName(), null ,GroupType.LECTURE, Visibility.PUBLIC);
AddUserEvent addUserEvent = new AddUserEvent(eventService.checkGroup(), account.getName(),account.getGivenname(),account.getFamilyname(),account.getEmail());
UpdateGroupTitleEvent updateGroupTitleEvent = new UpdateGroupTitleEvent(eventService.checkGroup(), account.getName(), title);
UpdateGroupDescriptionEvent updateGroupDescriptionEvent = new UpdateGroupDescriptionEvent(eventService.checkGroup(), account.getName(), beschreibung);
eventService.saveEvent(createGroupEvent);
eventService.saveEvent(addUserEvent);
eventService.saveEvent(updateGroupDescriptionEvent);
eventService.saveEvent(updateGroupTitleEvent);
return "redirect:/";
}

View File

@ -17,4 +17,9 @@ public class UpdateGroupDescriptionEvent extends Event {
super(event_id, group_id, user_id);
this.newGroupDescription = newGroupDescription;
}
public UpdateGroupDescriptionEvent(Long group_id, String user_id, String newGroupDescription) {
super(group_id, user_id);
this.newGroupDescription = newGroupDescription;
}
}

View File

@ -17,4 +17,9 @@ public class UpdateGroupTitleEvent extends Event {
super(event_id, group_id, user_id);
this.newGroupTitle = newGroupTitle;
}
public UpdateGroupTitleEvent(Long group_id, String user_id, String newGroupTitle) {
super(group_id, user_id);
this.newGroupTitle = newGroupTitle;
}
}