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:
Kasra Madadipouya 2023-05-24 23:16:59 +02:00 committed by GitHub
commit 75da1d17c6
1 changed files with 1 additions and 2 deletions

View File

@ -23,8 +23,7 @@ public class UserUtility {
for (Event event : events) {
if (event instanceof UserCreatedEvent) {
UserCreatedEvent e = (UserCreatedEvent) event;
user = new User(UUID.randomUUID()
.toString(), e.getFirstName(), e.getLastName());
user = new User(e.getUserId(), e.getFirstName(), e.getLastName());
}
if (event instanceof UserAddressAddedEvent) {
UserAddressAddedEvent e = (UserAddressAddedEvent) event;