1

Add UpdateGroupTitleEvent and UpdateGroupDescriptionEvent to Gruppen2Controller

This commit is contained in:
XXNitram
2020-03-12 15:22:10 +01:00
parent 9f40df9d59
commit 70d911c576
3 changed files with 16 additions and 1 deletions

View File

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

View File

@ -17,4 +17,9 @@ public class UpdateGroupDescriptionEvent extends Event {
super(event_id, group_id, user_id); super(event_id, group_id, user_id);
this.newGroupDescription = newGroupDescription; 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); super(event_id, group_id, user_id);
this.newGroupTitle = newGroupTitle; this.newGroupTitle = newGroupTitle;
} }
public UpdateGroupTitleEvent(Long group_id, String user_id, String newGroupTitle) {
super(group_id, user_id);
this.newGroupTitle = newGroupTitle;
}
} }