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.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,8 +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;
}
} }

View File

@ -28,9 +28,11 @@
<h1>Meine Gruppen</h1> <h1>Meine Gruppen</h1>
<div class="container-fluid"> <div class="container-fluid">
<form action="/" method="get"> <form action="/" method="get">
<div th:each="gruppe: ${gruppen}">
<div style="border: 10px solid aliceblue; background: aliceblue"> <div style="border: 10px solid aliceblue; background: aliceblue">
<h4 style="color: dodgerblue; font-weight: bold">Titel der Gruppe</h4> <h4 style="color: dodgerblue; font-weight: bold" th:text="${gruppe.getTitle()}"></h4>
<p>Beschreibung der Gruppe ...</p> <p th:text="${gruppe.getDescription()}"></p>
</div>
</div> </div>
</form> </form>
</div> </div>