Merge pull request #13719 from FabioBentoLuiz/fix/es-userutility
Event Sourcing - Recreate user with id from the UserCreatedEvent instead of creating a new one
This commit is contained in:
commit
75da1d17c6
|
@ -23,8 +23,7 @@ public class UserUtility {
|
||||||
for (Event event : events) {
|
for (Event event : events) {
|
||||||
if (event instanceof UserCreatedEvent) {
|
if (event instanceof UserCreatedEvent) {
|
||||||
UserCreatedEvent e = (UserCreatedEvent) event;
|
UserCreatedEvent e = (UserCreatedEvent) event;
|
||||||
user = new User(UUID.randomUUID()
|
user = new User(e.getUserId(), e.getFirstName(), e.getLastName());
|
||||||
.toString(), e.getFirstName(), e.getLastName());
|
|
||||||
}
|
}
|
||||||
if (event instanceof UserAddressAddedEvent) {
|
if (event instanceof UserAddressAddedEvent) {
|
||||||
UserAddressAddedEvent e = (UserAddressAddedEvent) event;
|
UserAddressAddedEvent e = (UserAddressAddedEvent) event;
|
||||||
|
|
Loading…
Reference in New Issue