1

Change UpdateGroupTitleEvent and UpdateGroupDescriptionEvent

This commit is contained in:
XXNitram
2020-03-16 15:44:31 +01:00
parent 22eede051b
commit 801ef1998c
3 changed files with 11 additions and 18 deletions

View File

@ -63,14 +63,6 @@ public class Group {
} }
} }
private void applyEvent(UpdateGroupTitleEvent event) {
this.title = event.getNewGroupTitle();
}
private void applyEvent(UpdateGroupDescriptionEvent event) {
this.description = event.getNewGroupDescription();
}
private void applyEvent(DeleteUserEvent event) throws UserNotFoundException { private void applyEvent(DeleteUserEvent event) throws UserNotFoundException {
User user = new User(event.getUser_id(), "", "", ""); User user = new User(event.getUser_id(), "", "", "");

View File

@ -3,6 +3,7 @@ package mops.gruppen2.domain.event;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import mops.gruppen2.domain.Group;
/** /**
* Ändert nur die Gruppenbeschreibung. * Ändert nur die Gruppenbeschreibung.
@ -13,13 +14,12 @@ import lombok.NoArgsConstructor;
public class UpdateGroupDescriptionEvent extends Event { public class UpdateGroupDescriptionEvent extends Event {
String newGroupDescription; String newGroupDescription;
public UpdateGroupDescriptionEvent(Long event_id, Long group_id, String user_id, String newGroupDescription) {
super(event_id, group_id, user_id);
this.newGroupDescription = newGroupDescription;
}
public UpdateGroupDescriptionEvent(Long group_id, String user_id, String newGroupDescription) { public UpdateGroupDescriptionEvent(Long group_id, String user_id, String newGroupDescription) {
super(group_id, user_id); super(group_id, user_id);
this.newGroupDescription = newGroupDescription; this.newGroupDescription = newGroupDescription;
} }
public void apply(Group group) {
group.setDescription(this.newGroupDescription);
}
} }

View File

@ -3,6 +3,7 @@ package mops.gruppen2.domain.event;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import mops.gruppen2.domain.Group;
/** /**
* Ändert nur den Gruppentitel. * Ändert nur den Gruppentitel.
@ -13,13 +14,13 @@ import lombok.NoArgsConstructor;
public class UpdateGroupTitleEvent extends Event { public class UpdateGroupTitleEvent extends Event {
String newGroupTitle; String newGroupTitle;
public UpdateGroupTitleEvent(Long event_id, Long group_id, String user_id, String newGroupTitle) {
super(event_id, group_id, user_id);
this.newGroupTitle = newGroupTitle;
}
public UpdateGroupTitleEvent(Long group_id, String user_id, String newGroupTitle) { public UpdateGroupTitleEvent(Long group_id, String user_id, String newGroupTitle) {
super(group_id, user_id); super(group_id, user_id);
this.newGroupTitle = newGroupTitle; this.newGroupTitle = newGroupTitle;
} }
public void apply(Group group) {
group.setTitle(this.newGroupTitle);
}
} }